In R, I have the following expression for which I would like to take sucessive derivatives with respect to s
(theta
and nu
are nothing but unspecified parameters):
expr <- expression(exp((nu / (theta * (1 - nu))) *
(1 - (1 + theta * s / nu)^(1 - nu))))
To do this, I recursively use the D() function that computes derivatives of simple expressions, symbolically.
But that function does not perform any simplification, i.e., it does not reduce the result into a simpler form.
If you try to take the 10th derivative, say, you will see that the result is very awesome and it requires a lot of computing time. At the limit, it is practically impossible, at least on my computer, to compute the 15th derivative.
Hence, I believe it is worth to try to simplify the n-1
th derivative before computing the n
th derivative.
I think it is possible to simplify expressions in R thanks to the Ryacas package.
However, my tests are not conclusive...
Does anyone of you has some experience with such a problem? Does anyone could give me some advice?
Thank you in advance!