Created
November 13, 2019 06:23
-
-
Save vithalreddy/27385735f2ca36a2dd54eb950b8c69d9 to your computer and use it in GitHub Desktop.
Taylor Series using Horner's Rule in Javascript
This file contains 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 ex(x, n, s = 1) { | |
if (n === 0) return s; | |
s = 1 + (x * s) / n; | |
return ex(x, n - 1, s); | |
} | |
console.log(ex(1, 10)); // 2.7182818011463845 | |
console.log(ex(5, 10)); // 146.38060102513225 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment