math3d-react icon indicating copy to clipboard operation
math3d-react copied to clipboard

Nth derivatives?

Open DownLoude opened this issue 1 year ago • 5 comments

Is there any way to take the nth derivative of a function (without making a function for each individual derivative). i.e.

f(x) = x^3 
f_n(n, x) = \frac{d^n}{{dx}^n} ( f(x) )
f(0, x) = f(x) =  x^3
f(1, x) = f^\prime(x) = 3x^2
f(2, x) = f^{\prime\prime}(x) = 6x
f(3, x) = f^{\prime\prime\prime}(x) = 6

This is not what I want to have to do, and also returns an error anyway e.apply is not a function.

d_2f(x) = \mathrm{diff}(\mathrm{diff}(f, x), x)

This is arguably even worse, but its what I'm using right now.

df(x) = \mathrm{diff}(f, x)
d_2f(x) = \mathrm{diff}(df, x)
d_3f(x) = \mathrm{diff}(d_2f, x)

This would be very nice for doing the Associated Legendre polynomials $P^m_\ell(x)$ which contains $\frac{d^m}{{dx}^m}(P_\ell(x))$

DownLoude avatar Apr 27 '23 09:04 DownLoude