# Simple $e^x$ Implementation $$ e^x \approx \sum\limits_{k=0}^\infty \frac{x^k}{k!} $$ $$ a_k := \frac{x^k}{k!} \implies a_k = a_{k-1} \times \frac{x}{k}\\ $$ ```!javascript function e(x, k = 10) { if (k == 0) return [1, 1]; let [sum, pre] = e(x, k-1); let Ak = pre * x / k; let sum += Ak; return [sum, Ak]; } ``` ###### tags: `math` `e`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up