Skip to content
New issue

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

第四次作業 -- 遞迴 請寫出 n 次微分的遞迴程式 #4

Open
ccckmit opened this issue Apr 24, 2019 · 1 comment
Open

第四次作業 -- 遞迴 請寫出 n 次微分的遞迴程式 #4

ccckmit opened this issue Apr 24, 2019 · 1 comment

Comments

@ccckmit
Copy link
Contributor

ccckmit commented Apr 24, 2019

df(f, x, n)

@zz860926
Copy link

zz860926 commented Apr 24, 2019

let h = 0.0001

function df(f,x,n){
    if(n==1){
        return (f(x+h)-f(x))/h
    }else{
        return ((df(f,x+h,n-1))-df(f,x,n-1))/h
        
    }
}

function f(x){
    return Math.exp(x)
}
console.log("df(f,1,2)",df(f,1,2))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants