# nthd(y,x) is the nth derivative of y to x; # assume n is natural number 0,1,2,...,n ; #nthd(y_,x_):= block(assume(n>0,isinteger(n)), d(y,x,n)); nthd(y_,x_):=if(hasnot(y,x),0); #nthd(a_*b_,x_):=if(isfree(a,x), a*nthd(b,x), if(b==x, d(a*x,x,n),sum(binomial(n,k)*d(a,x,n-k)*d(b,x,k),k,0,n) )); nthd(a_*b_,x_):=if(isfree(a,x), a*nthd(b,x)); nthd(a_+b_,x_):=nthd(a,x)+nthd(b,x); #nthd(x_^m_,x_):=if(m== -1,ln(1+n,x),fallingfactorial(m,n)*x^(m-n)); #nthd((a_+x_)^m_,x_):=if(isfree(a,x),if(m== -1,ln(1+n,a+x),fallingfactorial(m,n)*(a+x)^(m-n) )); #nthd(e^(x_^2),x_):=1/2*sqrt(pi)*erfi(1+n,x); #nthd(e^(-x_^2),x_):=1/2*sqrt(pi)*erf(1+n,x); nthd(a_*b_*c_,x_):=if(isfree(a,x),a*nthd(b*c,x)); nthd(y_):= block(assume(n>0),nthd(y,x));