On Fri, Apr 8, 2011 at 2:03 PM, Karsten Ahnert <karsten.ahn...@ambrosys.de> wrote: >> >> Why not just write a transform that calculates one derivative and call >> it N times to get the Nth derivative? > > Yes, that may be easy if you need two or three higher derivatives. For my > application I need 10 to 20 or even more. I guess that currently no > compiler can handle such large trees. For example, the simple product rule > will result in 2^N terms.
Point taken. The expressions might get very long. However, you could do an algeabric simplification transform (for example constant propagation) after every derivation step. Thus reducing the number of terms. > But in the case of the product rule, one can use Leibnitz rule: If > f(x)=g1(x) g2(x), then > the N-th derivative of f(x) is sum_{k=0}^N binomial(N , k ) g1^k(x) > g2^(N-k)(x). (g1^k is the k-th derivative of g1). This is exactly the > point where I need intermediate values, to store previously calculated > values of the derivatives of g1 and g2. > > Nevertheless, thank you for your example. I am a beginner with proto such > that every example is highly illuminating. _______________________________________________ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto