title: Symbolic derivatives and simplification in R
body: <p>In R, I have the following expression for which I would like to take sucessive derivatives with respect to <code>s</code> (<code>theta</code> and <code>nu</code> are nothing but unspecified parameters):</p>
  
  <pre><code>expr &lt;- expression(exp((nu / (theta * (1 - nu))) *
    (1 - (1 + theta * s / nu)^(1 - nu))))
  </code></pre>
  
  <p>To do this, I recursively use the <a href="http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/deriv.html">D()</a> function that computes derivatives of simple expressions, symbolically. </p>
  
  <p>But that function does not perform any simplification, i.e., it does not reduce the result into a simpler form.</p>
  
  <p>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.</p>
  
  <p>Hence, I believe it is worth to try to simplify the <code>n-1</code>th derivative before computing the <code>n</code>th derivative. </p>
  
  <p>I think it is possible to simplify expressions in R thanks to the <a href="http://cran.r-project.org/web/packages/Ryacas/Ryacas.pdf">Ryacas</a> package. </p>
  
  <p>However, my tests are not conclusive...</p>
  
  <p>Does anyone of you has some experience with such a problem?
  Does anyone could give me some advice?</p>
  
  <p>Thank you in advance!</p>