In connection with recent developments for symbolic sequences, a number of improvements were implemented regarding symbolic differentiation, that is the computation of order derivatives were n is a symbol, the simplest example being the derivative of the exponential, which of course is the exponential itself. This post is about these developments, done in collaboration with Katherina von Bülow, and available for download as usual from the Maplesoft R&D web page for Differential Equations and Mathematical functions (the update itself is bundled with the official updates of the Maple Physics package).
It is important to note that Maple is pioneer in having an actual implementation of symbolic differentiation, something that works for real, since several releases. The development, however, was somewhat stuck because we were unable to compute the symbolic derivative of a composite function . A formula for this problem is actually known, it is the Faà di Bruno formula, but, in order to implement it, first we were missing the incomplete Bell functions , that got implemented in Maple 15, nice, but then we were still missing differentiating symbolic sequences, and functions whose arguments are symbolic sequences (i.e. the number of arguments of the function is n, a symbol, of unknown value at the time of differentiating). All this got implemented now within the new MathematicalFunctions:-Sequence package, opening the door widely to these improvements in differentiation.
The symbolic differentiation code works as mostly all other computer algebra code, by mapping complicated problems into a composition of simpler problems all of which are tractable; what follows is then an illustration of these basic cases.
Among the simplest new case that can now be handled there is that of a power where the exponent is linear in the differentiation variable. This is actually an easy problem
> |

|

|
(1) |
More complicated, consider the power of a generic function; the corresponding symbolic derivative can be mapped into a sum of symbolic derivatives of powers of with lower degree
> |

|
![%diff(g(z)^k, `$`(z, n)) = k*binomial(n-k, n)*(Sum((-1)^_k1*binomial(n, _k1)*g(z)^(k-_k1)*(Diff(g(z)^_k1, [`$`(z, n)]))/(k-_k1), _k1 = 0 .. n))](/view.aspx?sf=201214_post/bb665ba14fde446f090719f4a06b3238.gif)
|
(2) |
In some cases where is a known function, the computation can be carried on furthermore. For example, for the result can be expressed using Stirling numbers of the first kind
> |

|

|
(3) |
The case of sin and cos are relatively simpler, but then assumptions on the exponent are required in order to proceed further ahead from (2), for example
> |
![`assuming`([(%diff = diff)(sin(alpha*z+beta)^k, `$`(z, n))], [k::posint])](/view.aspx?sf=201214_post/02785a61e52e5a3cef30c51e88dde0f8.gif)
|

|
(4) |
The case of functions of arbitrary number of variables (typical situation where symbolic sequences are required) is now handled properly. This is the pFq hypergeometric function of symbolic order p and q
> |
![(%diff = diff)(hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[j], j = 1 .. q)], z), `$`(z, n))](/view.aspx?sf=201214_post/ed0eee7cd1c9cf51b78664cc05484f64.gif)
|
![%diff(hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[j], j = 1 .. q)], z), `$`(z, n)) = (product(pochhammer(a[i], n), i = 1 .. p))*hypergeom([`$`(a[i]+n, i = 1 .. p)], [`$`(b[j]+n, j = 1 .. q)], z)/(product(pochhammer(b[j], n), j = 1 .. q))](/view.aspx?sf=201214_post/21c9327e4e89f9f93f9643b60111d17a.gif)
|
(5) |
The case of the MeijerG function is more complicated, but in practice, for the computer, once it knows how to handle symbolic sequences, the more involved problem becomes computable
> |
![(%diff = diff)(MeijerG([[`$`(a[i], i = 1 .. n)], [`$`(b[i], i = n+1 .. p)]], [[`$`(b[i], i = 1 .. m)], [`$`(b[i], i = m+1 .. q)]], z), `$`(z, k))](/view.aspx?sf=201214_post/11a4474a6606606f66ea4de3700794d6.gif)
|
![%diff(MeijerG([[`$`(a[i], i = 1 .. n)], [`$`(b[i], i = n+1 .. p)]], [[`$`(b[i], i = 1 .. m)], [`$`(b[i], i = m+1 .. q)]], z), `$`(z, k)) = MeijerG([[-k, `$`(a[i]-k, i = 1 .. n)], [`$`(b[i]-k, i = n+1 .. p)]], [[`$`(b[i]-k, i = 1 .. m)], [0, `$`(b[i]-k, i = m+1 .. q)]], z)](/view.aspx?sf=201214_post/591a0fa7cb8d0bf2612614821d9cc961.gif)
|
(6) |
Not only the mathematics of this result is correct: the object returned is actually computable to the end (if you provide the values of n, p, m and q), and the typesetting is actually fully readable, as in textbooks, including copy and paste working properly; all this is new.
The derivative of a number of mathematical functions that were not implemented before, are now also implemented, covering the gaps, for example:
> |

|

|
(7) |
> |

|

|
(8) |
> |

|

|
(9) |
> |

|

|
(10) |
In the same way the fundamental formulas for the derivative of all the 12 elliptic Jacobi functions as well as the four elliptic JacobiTheta functions, the LambertW , LegendreP and some others are now all implemented.
Finally there is the "holy grail" of this problem: the derivative of a composite function - this always-unreachable implementation of Faa di Bruno formula. We now have it :)
> |

|
![%diff(f(g(z)), `$`(z, n)) = Sum(((D@@k)(f))(g(z))*IncompleteBellB(n, k, `$`(diff(g(z), [`$`(z, j)]), j = 1 .. n-k+1)), k = 0 .. n)](/view.aspx?sf=201214_post/5827df777e045cb7bde9e1a315976d79.gif)
|
(11) |
Note the symbolic sequence of symbolic order derivatives of lower degree, both of of f and g, also within the arguments of the IncompleteBellB function. This is a very abstract formula ... And does this really work? Of course it does :). Consider, for instance, a case where the derivatives of and can both be computed by the system:
> |

|

|
(12) |
This is the derivative expressed using Faa di Bruno's formula, in turn expressed using symbolic sequences within the IncompleteBellB function
> |

|

|
(13) |
These results can all be verified. Take for instance 
> |

|

|
(14) |
Compute now the inert functions: on the left-hand side this is just the (now explicit) 3rd order derivative, while on the right-hand side we have a sum of IncompleteBellB functions, where the number of arguments, expressed in (13) using symbolic sequences that depend on the summation index k and the differentiation order n, now in (14) depend only on , and get transformed into explicit sequences of arguments when the summation is performed and k assumes integer values
> |

|

|
(15) |
Take left-hand side minus right-hand side
> |

|

|
(16) |
> |

|
:)
|