Boost logo

Proto :

Subject: Re: [proto] Manipulating an expression tree
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2011-04-08 08:03:57

> 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.

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 list run by eric at