Created
September 27, 2019 23:50
-
-
Save dannydenenberg/3c5f3232d797ba63eae2cb1d8f2e00de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doIt() { | |
| // gather variable data | |
| const nth = parseInt(document.getElementById("nth").value); | |
| const expr = document.getElementById("expr").value; | |
| const respectTo = document.getElementById("respectTo").value; | |
| const answer = `${math.format( | |
| nthDerivative(expr, nth, respectTo), | |
| 14 | |
| )}`; | |
| katex.render(answer, document.getElementById("nth-derivative")); | |
| } | |
| function nthDerivative(expr, n, respectTo) { | |
| let ans = math.derivative(expr, respectTo); | |
| for (let i = 0; i < n - 1; i++) { | |
| ans = math.derivative(ans, respectTo); | |
| } | |
| return ans; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Top up your balance