Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symbolic derivatives and simplification in R

Tags:

r

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-1th derivative before computing the nth 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!

like image 702
Marco Avatar asked Sep 05 '11 19:09

Marco


People also ask

How do you do derivatives in R?

In R programming, derivative of a function can be computed using deriv() and D() function. It is used to compute derivatives of simple expressions.

What is E in derivatives?

It is written as f(x) = ex, where 'e' is the Euler's number and its value is approximately 2.718. The differentiation of e to the power x can be done using different methods such as the first principle of differentiation and derivative of ax.

What is derivative in basic calculus?

derivative, in mathematics, the rate of change of a function with respect to a variable. Derivatives are fundamental to the solution of problems in calculus and differential equations.


3 Answers

Here an example:

> library(Ryacas)
> s <- Sym("s")
> nu <- Sym("nu")
> theta <- Sym("theta")
> e <- exp((nu / (theta * (1 - nu))) * (1 - (1 + theta * s / nu)^(1 - nu)))
> de <- deriv(e, s)
> de
expression(-(exp((1 - (theta * s/nu + 1)^(1 - nu)) * nu/(theta * 
    (1 - nu))) * (theta * (1 - nu) * (nu * ((theta * s/nu + 1)^(1 - 
    nu - 1) * ((1 - nu) * (nu * theta)))))/nu^2)/(theta * (1 - 
    nu))^2)
> Simplify(de)
expression(-(exp((1 - (theta * s/nu + 1)^(1 - nu)) * nu/(theta * 
    (1 - nu))) * (theta * s/nu + 1)^(1 - nu - 1)))

Note that we did get some simplification but the simplification was not perfect since the 1 - nu - 1 at the end could have been further simplified but was not.

Here is an example of repeated derivatives (however, you will likely run into trouble if you really need to take this as high as 10):

> de <- e
> for(i in 1:3) print(de <- Simplify(deriv(de, s)))
expression(-(exp((1 - (theta * s/nu + 1)^(1 - nu)) * nu/(theta * 
    (1 - nu))) * (theta * s/nu + 1)^(1 - nu - 1)))
expression((((theta * s/nu + 1)^(1 - nu - 1))^2 * exp((1 - (theta * 
    s/nu + 1)^(1 - nu)) * nu/(theta * (1 - nu))) * nu^2 + exp((1 - 
    (theta * s/nu + 1)^(1 - nu)) * nu/(theta * (1 - nu))) * theta * 
    nu^2 * (theta * s/nu + 1)^(1 - nu - 1 - 1))/nu^2)
expression((-3 * (nu * (theta * s/nu + 1)^(1 - nu - 1) * (theta * 
    s/nu + 1)^(1 - nu - 1 - 1) * theta) - nu * ((theta * s/nu + 
    1)^(1 - nu - 1))^3 - nu * theta^2 * (theta * s/nu + 1)^(1 - 
    nu - 1 - 1 - 1) - theta^2 * (theta * s/nu + 1)^(1 - nu - 
    1 - 1 - 1)) * exp((1 - (theta * s/nu + 1)^(1 - nu)) * nu/(theta * 
    (1 - nu)))/nu)

Added:

If the intermediate results are not needed one can do this to get the second derivative but again its unlikely it will handle a 10th derivative:

> Simplify(deriv(e, s, 2))
expression(exp((1 - (theta * s/nu + 1)^(1 - nu)) * nu/(theta * 
    (1 - nu))) * (theta * (theta * s/nu + 1)^(1 - nu - 1 - 1) + 
    ((theta * s/nu + 1)^(1 - nu - 1))^2))
like image 131
G. Grothendieck Avatar answered Oct 06 '22 07:10

G. Grothendieck


For what it's worth, this seems pretty in easy in Sage . I haven't ever done more than putter with it, but I could do this by doing the derivative computation in Sage and then cutting & pasting the resulting expression into R (ugly but seems to get this particular job done). (Scroll down to the bottom of the code block for a few lines of R code ...) Sage also has an R interface, although I haven't tried it out.

In Sage (see http://www.sagenb.org/home/pub/3121) [one could make the expression a little more compact/easier to cut and paste, although even less readable, by using one-letter variable names (i.e. n and t instead of nu and theta)]:

nu = var('nu'); theta=var('theta')
s= var('s'); myexpr = exp((nu / (theta * (1 - nu))) *
  (1 - (1 + theta * s / nu)^(1 - nu)))
simplify(derivative(myexpr,s,15))
##

In R, cutting and pasting from Sage:

Rderivexpr <- expression(
-(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*
(nu + 7)*(nu +
8)*(nu + 9)*(nu + 10)*(nu + 11)*(nu + 12)*(nu + 13)*theta^14*(s*theta/nu
+ 1)^(-nu - 14)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^13 - 6435*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu + 4)^2*(nu
+ 5)^2*(nu + 6)*theta^13*(s*theta/nu + 1)^(-2*nu - 13)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^11 - 5005*(nu + 1)^2*(nu +
2)^2*(nu + 3)^2*(nu + 4)^2*(nu + 5)*(nu + 6)*(nu +
7)*theta^13*(s*theta/nu + 1)^(-2*nu - 13)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^11 - 3003*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*theta^13*(s*theta/nu +
1)^(-2*nu - 13)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^11 - 1365*(nu + 1)^2*(nu + 2)^2*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*theta^13*(s*theta/nu + 1)^(-2*nu
- 13)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^11 -
455*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu
+ 8)*(nu + 9)*(nu + 10)*theta^13*(s*theta/nu + 1)^(-2*nu -
13)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^11 -
15*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu +
8)*(nu + 9)*(nu + 10)*(nu + 11)*(nu + 12)*theta^13*(s*theta/nu +
1)^(-2*nu - 13)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^12 - 105*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu
+ 6)*(nu + 7)*(nu + 8)*(nu + 9)*(nu + 10)*(nu + 11)*theta^13*(s*theta/nu
+ 1)^(-2*nu - 13)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^11 - 126126*(nu + 1)^3*(nu + 2)^3*(nu +
3)^3*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^9 - 630630*(nu + 1)^3*(nu + 2)^3*(nu +
3)^2*(nu + 4)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 - 225225*(nu + 1)^3*(nu +
2)^3*(nu + 3)*(nu + 4)*(nu + 5)*theta^12*(s*theta/nu + 1)^(-3*nu -
12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 -
210210*(nu + 1)^3*(nu + 2)^2*(nu + 3)^2*(nu + 4)^2*theta^12*(s*theta/nu
+ 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^9 - 360360*(nu + 1)^3*(nu + 2)^2*(nu + 3)^2*(nu + 4)*(nu +
5)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^9 - 225225*(nu + 1)^3*(nu + 2)^2*(nu +
3)*(nu + 4)*(nu + 5)*(nu + 6)*theta^12*(s*theta/nu + 1)^(-3*nu -
12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 -
50050*(nu + 1)^3*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^9 - 25740*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)^2*(nu + 5)^2*theta^12*(s*theta/nu + 1)^(-3*nu -
12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^10 -
45045*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu + 4)^2*(nu + 5)*(nu +
6)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^10 - 180180*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)^2*(nu + 5)*theta^12*(s*theta/nu + 1)^(-3*nu -
12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 -
30030*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^10 - 135135*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)*(nu + 5)*(nu + 6)*theta^12*(s*theta/nu + 1)^(-3*nu -
12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 -
15015*(nu + 1)^2*(nu + 2)^2*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*(nu + 8)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^10 - 75075*(nu + 1)^2*(nu +
2)^2*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*theta^12*(s*theta/nu +
1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^9 - 5460*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*theta^12*(s*theta/nu + 1)^(-3*nu
- 12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^10 -
30030*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*(nu + 8)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 - 105*(nu + 1)*(nu + 2)*(nu
+ 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*(nu + 10)*(nu
+ 11)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^11 - 1365*(nu + 1)*(nu + 2)*(nu + 3)*(nu
+ 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*(nu +
10)*theta^12*(s*theta/nu + 1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^10 - 4095*(nu + 1)*(nu + 2)*(nu + 3)*(nu
+ 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*theta^12*(s*theta/nu +
1)^(-3*nu - 12)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^9 - 2627625*(nu + 1)^4*(nu + 2)^3*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^7 - 6306300*(nu + 1)^4*(nu + 2)^2*(nu +
3)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^7 - 1401400*(nu + 1)^4*(nu + 2)*(nu +
3)*(nu + 4)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 - 1891890*(nu + 1)^3*(nu +
2)^3*(nu + 3)^2*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 - 1576575*(nu + 1)^3*(nu +
2)^3*(nu + 3)*(nu + 4)*theta^11*(s*theta/nu + 1)^(-4*nu -
11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 -
4729725*(nu + 1)^3*(nu + 2)^3*(nu + 3)*theta^11*(s*theta/nu + 1)^(-4*nu
- 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
2522520*(nu + 1)^3*(nu + 2)^2*(nu + 3)^2*(nu + 4)*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^8 - 3783780*(nu + 1)^3*(nu + 2)^2*(nu +
3)^2*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^7 - 1801800*(nu + 1)^3*(nu + 2)^2*(nu +
3)*(nu + 4)*(nu + 5)*theta^11*(s*theta/nu + 1)^(-4*nu -
11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 -
6306300*(nu + 1)^3*(nu + 2)^2*(nu + 3)*(nu + 4)*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^7 - 450450*(nu + 1)^3*(nu + 2)*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 - 1801800*(nu + 1)^3*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*theta^11*(s*theta/nu + 1)^(-4*nu -
11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
180180*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu + 4)^2*(nu +
5)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^9 - 630630*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)^2*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 - 135135*(nu + 1)^2*(nu +
2)^2*(nu + 3)^2*(nu + 4)*(nu + 5)*(nu + 6)*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^9 - 1081080*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu + 4)*(nu
+ 5)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^8 - 1891890*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 - 75075*(nu + 1)^2*(nu +
2)^2*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^9 - 675675*(nu + 1)^2*(nu + 2)^2*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 - 1351350*(nu + 1)^2*(nu +
2)^2*(nu + 3)*(nu + 4)*(nu + 5)*theta^11*(s*theta/nu + 1)^(-4*nu -
11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
30030*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*(nu + 8)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 - 300300*(nu + 1)^2*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^8 - 675675*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 - 455*(nu + 1)*(nu + 2)*(nu
+ 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*(nu +
10)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^10 - 8190*(nu + 1)*(nu + 2)*(nu + 3)*(nu
+ 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*(nu + 9)*theta^11*(s*theta/nu +
1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^9 - 45045*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu
+ 6)*(nu + 7)*(nu + 8)*theta^11*(s*theta/nu + 1)^(-4*nu -
11)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 -
75075*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*theta^11*(s*theta/nu + 1)^(-4*nu - 11)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^7 - 1401400*(nu + 1)^5*theta^10*(s*theta/nu
+ 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^5 - 15765750*(nu + 1)^4*(nu + 2)^2*theta^10*(s*theta/nu +
1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^6 - 8408400*(nu + 1)^4*(nu + 2)*(nu +
3)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^6 - 21021000*(nu + 1)^4*(nu +
2)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^5 - 4729725*(nu + 1)^3*(nu + 2)^3*(nu +
3)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^7 - 7882875*(nu + 1)^3*(nu +
2)^3*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^6 - 3783780*(nu + 1)^3*(nu + 2)^2*(nu +
3)^2*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^7 - 6306300*(nu + 1)^3*(nu + 2)^2*(nu +
3)*(nu + 4)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 - 37837800*(nu + 1)^3*(nu +
2)^2*(nu + 3)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 - 23648625*(nu + 1)^3*(nu +
2)^2*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^5 - 1801800*(nu + 1)^3*(nu + 2)*(nu +
3)*(nu + 4)*(nu + 5)*theta^10*(s*theta/nu + 1)^(-5*nu -
10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
12612600*(nu + 1)^3*(nu + 2)*(nu + 3)*(nu + 4)*theta^10*(s*theta/nu +
1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^6 - 18918900*(nu + 1)^3*(nu + 2)*(nu +
3)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^5 - 210210*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*(nu + 4)^2*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 - 360360*(nu + 1)^2*(nu +
2)^2*(nu + 3)^2*(nu + 4)*(nu + 5)*theta^10*(s*theta/nu + 1)^(-5*nu -
10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 -
3783780*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu + 4)*theta^10*(s*theta/nu +
1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^7 - 5675670*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^6 - 225225*(nu + 1)^2*(nu + 2)^2*(nu +
3)*(nu + 4)*(nu + 5)*(nu + 6)*theta^10*(s*theta/nu + 1)^(-5*nu -
10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 -
2702700*(nu + 1)^2*(nu + 2)^2*(nu + 3)*(nu + 4)*(nu +
5)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^7 - 9459450*(nu + 1)^2*(nu + 2)^2*(nu +
3)*(nu + 4)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 - 9459450*(nu + 1)^2*(nu +
2)^2*(nu + 3)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 - 100100*(nu + 1)^2*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*theta^10*(s*theta/nu +
1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^8 - 1351350*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 - 5405400*(nu + 1)^2*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*theta^10*(s*theta/nu + 1)^(-5*nu -
10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 -
6306300*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*theta^10*(s*theta/nu +
1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^5 - 1365*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu
+ 6)*(nu + 7)*(nu + 8)*(nu + 9)*theta^10*(s*theta/nu + 1)^(-5*nu -
10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^9 -
30030*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu
+ 8)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^8 - 225225*(nu + 1)*(nu + 2)*(nu +
3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*theta^10*(s*theta/nu + 1)^(-5*nu
- 10)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
675675*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu +
6)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^6 - 675675*(nu + 1)*(nu + 2)*(nu + 3)*(nu +
4)*(nu + 5)*theta^10*(s*theta/nu + 1)^(-5*nu - 10)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 - 21021000*(nu + 1)^4*(nu +
2)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^5 - 21021000*(nu + 1)^4*theta^9*(s*theta/nu +
1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^4 - 2627625*(nu + 1)^3*(nu + 2)^3*theta^9*(s*theta/nu +
1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^6 - 12612600*(nu + 1)^3*(nu + 2)^2*(nu +
3)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^6 - 47297250*(nu + 1)^3*(nu +
2)^2*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^5 - 4204200*(nu + 1)^3*(nu + 2)*(nu +
3)*(nu + 4)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 - 37837800*(nu + 1)^3*(nu +
2)*(nu + 3)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 - 94594500*(nu + 1)^3*(nu +
2)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^4 - 21021000*(nu + 1)^3*theta^9*(s*theta/nu +

1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^3 - 630630*(nu + 1)^2*(nu + 2)^2*(nu + 3)^2*(nu +
4)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^7 - 3783780*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^6 - 450450*(nu + 1)^2*(nu + 2)^2*(nu +
3)*(nu + 4)*(nu + 5)*theta^9*(s*theta/nu + 1)^(-6*nu -
9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
6306300*(nu + 1)^2*(nu + 2)^2*(nu + 3)*(nu + 4)*theta^9*(s*theta/nu +
1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^6 - 28378350*(nu + 1)^2*(nu + 2)^2*(nu +
3)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^5 - 23648625*(nu + 1)^2*(nu +
2)^2*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^4 - 225225*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu
+ 4)*(nu + 5)*(nu + 6)*theta^9*(s*theta/nu + 1)^(-6*nu -
9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^7 -
3603600*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*(nu +
5)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^6 - 18918900*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu
+ 4)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^5 - 37837800*(nu + 1)^2*(nu + 2)*(nu +
3)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^4 - 23648625*(nu + 1)^2*(nu +
2)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^3 - 3003*(nu + 1)*(nu + 2)*(nu + 3)*(nu +
4)*(nu + 5)*(nu + 6)*(nu + 7)*(nu + 8)*theta^9*(s*theta/nu + 1)^(-6*nu -
9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^8 -
75075*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu +
7)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^7 - 675675*(nu + 1)*(nu + 2)*(nu + 3)*(nu +
4)*(nu + 5)*(nu + 6)*theta^9*(s*theta/nu + 1)^(-6*nu -
9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 -
2702700*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*theta^9*(s*theta/nu
+ 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^5 - 4729725*(nu + 1)*(nu + 2)*(nu + 3)*(nu +
4)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^4 - 2837835*(nu + 1)*(nu + 2)*(nu +
3)*theta^9*(s*theta/nu + 1)^(-6*nu - 9)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^3 - 7007000*(nu + 1)^4*theta^8*(s*theta/nu +
1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^4 - 7882875*(nu + 1)^3*(nu + 2)^2*theta^8*(s*theta/nu +
1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^5 - 6306300*(nu + 1)^3*(nu + 2)*(nu +
3)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^5 - 63063000*(nu + 1)^3*(nu +
2)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^4 - 63063000*(nu + 1)^3*theta^8*(s*theta/nu +
1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^3 - 378378*(nu + 1)^2*(nu + 2)^2*(nu +
3)^2*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^6 - 630630*(nu + 1)^2*(nu + 2)^2*(nu +
3)*(nu + 4)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 - 9459450*(nu + 1)^2*(nu +
2)^2*(nu + 3)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 - 23648625*(nu + 1)^2*(nu +
2)^2*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^4 - 360360*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu
+ 4)*(nu + 5)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 - 6306300*(nu + 1)^2*(nu +
2)*(nu + 3)*(nu + 4)*theta^8*(s*theta/nu + 1)^(-7*nu -
8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 -
37837800*(nu + 1)^2*(nu + 2)*(nu + 3)*theta^8*(s*theta/nu + 1)^(-7*nu -
8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^4 -
94594500*(nu + 1)^2*(nu + 2)*theta^8*(s*theta/nu + 1)^(-7*nu -
8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^3 -
47297250*(nu + 1)^2*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu
+ 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^2 - 5005*(nu + 1)*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu + 6)*(nu + 7)*theta^8*(s*theta/nu +
1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^7 - 135135*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu +
5)*(nu + 6)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^6 - 1351350*(nu + 1)*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*theta^8*(s*theta/nu + 1)^(-7*nu -
8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 -
6306300*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*theta^8*(s*theta/nu +
1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^4 - 14189175*(nu + 1)*(nu + 2)*(nu +
3)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^3 - 14189175*(nu + 1)*(nu +
2)*theta^8*(s*theta/nu + 1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^2 - 4729725*(nu + 1)*theta^8*(s*theta/nu +
1)^(-7*nu - 8)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu - 6306300*(nu + 1)^3*(nu + 2)*theta^7*(s*theta/nu +
1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^4 - 21021000*(nu + 1)^3*theta^7*(s*theta/nu + 1)^(-8*nu -
7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^3 -
630630*(nu + 1)^2*(nu + 2)^2*(nu + 3)*theta^7*(s*theta/nu + 1)^(-8*nu -
7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 -
4729725*(nu + 1)^2*(nu + 2)^2*theta^7*(s*theta/nu + 1)^(-8*nu -
7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^4 -
420420*(nu + 1)^2*(nu + 2)*(nu + 3)*(nu + 4)*theta^7*(s*theta/nu +
1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^5 - 7567560*(nu + 1)^2*(nu + 2)*(nu +
3)*theta^7*(s*theta/nu + 1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^4 - 47297250*(nu + 1)^2*(nu +
2)*theta^7*(s*theta/nu + 1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta))/nu^3 - 63063000*(nu + 1)^2*theta^7*(s*theta/nu +
1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^2 - 6435*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*(nu + 5)*(nu
+ 6)*theta^7*(s*theta/nu + 1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^6 - 180180*(nu + 1)*(nu + 2)*(nu + 3)*(nu +
4)*(nu + 5)*theta^7*(s*theta/nu + 1)^(-8*nu - 7)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 - 1891890*(nu + 1)*(nu +
2)*(nu + 3)*(nu + 4)*theta^7*(s*theta/nu + 1)^(-8*nu -
7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^4 -
9459450*(nu + 1)*(nu + 2)*(nu + 3)*theta^7*(s*theta/nu + 1)^(-8*nu -
7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^3 -
23648625*(nu + 1)*(nu + 2)*theta^7*(s*theta/nu + 1)^(-8*nu -
7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^2 -
28378350*(nu + 1)*theta^7*(s*theta/nu + 1)^(-8*nu - 7)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu - 2027025*theta^7*(s*theta/nu
+ 1)^(-8*nu - 7)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta)) - 1401400*(nu + 1)^3*theta^6*(s*theta/nu + 1)^(-9*nu -
6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^3 -
225225*(nu + 1)^2*(nu + 2)^2*theta^6*(s*theta/nu + 1)^(-9*nu -
6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^4 -
360360*(nu + 1)^2*(nu + 2)*(nu + 3)*theta^6*(s*theta/nu + 1)^(-9*nu -
6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^4 -
6306300*(nu + 1)^2*(nu + 2)*theta^6*(s*theta/nu + 1)^(-9*nu -
6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^3 -
18918900*(nu + 1)^2*theta^6*(s*theta/nu + 1)^(-9*nu - 6)*e^(((s*theta/nu
+ 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^2 - 6435*(nu + 1)*(nu +
2)*(nu + 3)*(nu + 4)*(nu + 5)*theta^6*(s*theta/nu + 1)^(-9*nu -
6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^5 -
180180*(nu + 1)*(nu + 2)*(nu + 3)*(nu + 4)*theta^6*(s*theta/nu +
1)^(-9*nu - 6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^4 - 1891890*(nu + 1)*(nu + 2)*(nu + 3)*theta^6*(s*theta/nu
+ 1)^(-9*nu - 6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^3 - 9459450*(nu + 1)*(nu + 2)*theta^6*(s*theta/nu +
1)^(-9*nu - 6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^2 - 23648625*(nu + 1)*theta^6*(s*theta/nu + 1)^(-9*nu -
6)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu -
4729725*theta^6*(s*theta/nu + 1)^(-9*nu - 6)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta)) - 225225*(nu + 1)^2*(nu +
2)*theta^5*(s*theta/nu + 1)^(-10*nu - 5)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^3 - 1801800*(nu + 1)^2*theta^5*(s*theta/nu
+ 1)^(-10*nu - 5)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu^2 - 5005*(nu + 1)*(nu + 2)*(nu + 3)*(nu +
4)*theta^5*(s*theta/nu + 1)^(-10*nu - 5)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^4 - 135135*(nu + 1)*(nu + 2)*(nu +
3)*theta^5*(s*theta/nu + 1)^(-10*nu - 5)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^3 - 1351350*(nu + 1)*(nu +
2)*theta^5*(s*theta/nu + 1)^(-10*nu - 5)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^2 - 6306300*(nu + 1)*theta^5*(s*theta/nu +
1)^(-10*nu - 5)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu - 2837835*theta^5*(s*theta/nu + 1)^(-10*nu -
5)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta)) - 50050*(nu
+ 1)^2*theta^4*(s*theta/nu + 1)^(-11*nu - 4)*e^(((s*theta/nu + 1)^(-nu +
1) - 1)*nu/((nu - 1)*theta))/nu^2 - 3003*(nu + 1)*(nu + 2)*(nu +
3)*theta^4*(s*theta/nu + 1)^(-11*nu - 4)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^3 - 75075*(nu + 1)*(nu +
2)*theta^4*(s*theta/nu + 1)^(-11*nu - 4)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu^2 - 675675*(nu + 1)*theta^4*(s*theta/nu +
1)^(-11*nu - 4)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/nu - 675675*theta^4*(s*theta/nu + 1)^(-11*nu -
4)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta)) - 1365*(nu +
1)*(nu + 2)*theta^3*(s*theta/nu + 1)^(-12*nu - 3)*e^(((s*theta/nu +
1)^(-nu + 1) - 1)*nu/((nu - 1)*theta))/nu^2 - 30030*(nu +
1)*theta^3*(s*theta/nu + 1)^(-12*nu - 3)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu - 75075*theta^3*(s*theta/nu + 1)^(-12*nu -
3)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta)) - 455*(nu +
1)*theta^2*(s*theta/nu + 1)^(-13*nu - 2)*e^(((s*theta/nu + 1)^(-nu + 1)
- 1)*nu/((nu - 1)*theta))/nu - 4095*theta^2*(s*theta/nu + 1)^(-13*nu -
2)*e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu - 1)*theta)) -
105*theta*(s*theta/nu + 1)^(-14*nu - 1)*e^(((s*theta/nu + 1)^(-nu + 1) -
1)*nu/((nu - 1)*theta)) - e^(((s*theta/nu + 1)^(-nu + 1) - 1)*nu/((nu -
1)*theta))/(s*theta/nu + 1)^(15*nu))
dfun <- function(x,nu=1,theta=1) {
  eval(Rderivexpr,list(s=x,e=exp(1),nu=nu,theta=theta))
}
curve(dfun(x,nu=0.5,theta=0.5),from=5,to=6)
like image 27
Ben Bolker Avatar answered Oct 06 '22 06:10

Ben Bolker


Well, R is not a symbolic language. If Ryacas or other tools such as macsyma don't give you the simplification you want, you'll have to Google for algebraic language tools. Or buy Mathematica, an expensive alternative, to say the least. See also derivative of a function for more advice.

As an aside: it's always a good idea to search the R-help and the StackOverflow archives before asking a question.

like image 30
Carl Witthoft Avatar answered Oct 06 '22 08:10

Carl Witthoft