We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const h = 0.001 function df(f, x, n) { if (n===0) return f(x) return (df(f,x+h,n-1)-df(f,x,n-1))/h } function f(x) { return Math.exp(x) // return Math.sin(x) } for (let n=0; n<=15; n++) { console.log('df(f,1,%d)=', n, df(f, 1, n)) }
執行結果
csienqu-teacher:04-search csienqu$ node diffn df(f,1,0)= 2.718281828459045 df(f,1,1)= 2.7196414225332255 df(f,1,2)= 2.721001696848191 df(f,1,3)= 2.7223623355610016 df(f,1,4)= 2.724043213220284 df(f,1,5)= 2.220446049250313 df(f,1,6)= 1332.2676295501878 df(f,1,7)= -3108624.4689504383 df(f,1,8)= 5329070518.200751 df(f,1,9)= -5329070518200.751 df(f,1,10)= -3996802888650563.5 df(f,1,11)= 37747582837255315000 df(f,1,12)= -1.2390088954816745e+23 df(f,1,13)= 3.0908609005564358e+26 df(f,1,14)= -6.634692795159935e+29 df(f,1,15)= 1.2803091919977304e+33
The text was updated successfully, but these errors were encountered:
No branches or pull requests
執行結果
The text was updated successfully, but these errors were encountered: