var dx = 0.001;
function f(x) {return x*x}
function d(x){return (f(x+(dx/2)) - f(x-(dx/2))) / dx}
function d2(x){return (d(x+(dx/2)) - d(x-(dx/2))) / dx}
function d3(x){return (d2(x+(dx/2)) - d2(x-(dx/2))) / dx}
我有这些函数来计算导数,有没有办法将所有这些都放在一个函数中,该函数以x为输入,n为第n个导数?