GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaScript/Maths/ExponentialFunction.js at master · TheAlgorithms/JavaScript Expand file tree/ Copy pathExponentialFunction.jsMore file actions 25 lines (24 loc) · 651 Bytes / Copy pathExponentialFunction.jsFile metadata and controls25 lines (24 loc) · 651 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 /** * @function exponentialFunction * @description Calculates the n+1 th order Taylor series approximation of exponential function e^x given n * @param {Integer} power * @param {Integer} order - 1 * @returns exponentialFunction(2,20) = 7.3890560989301735 * @url https://en.wikipedia.org/wiki/Exponential_function */ function exponentialFunction(power, n) { let output = 0 let fac = 1 if (isNaN(power) || isNaN(n) || n < 0) { throw new TypeError('Invalid Input') } if (n === 0) { return 1 } for (let i = 0; i < n; i++) { output += power ** i / fac fac *= i + 1 } return output } export { exponentialFunction } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |