Boost logo

Boost :

From: deane_yang (Deane_Yang_at_[hidden])
Date: 2002-02-12 22:13:13


--- In boost_at_y..., Peter Schmitteckert (boost) <boost_at_s...> wrote:
> Salut,
>
> How would you implement a recursion for
> differential_number<N, double>::exp( x );
>
> Currently I do the following for the second order:
>
> template<class T>
> diff2<T> exp(const diff2<T> a)
> {
> const diff<T> r( exp( diff<T>(a.d0(), a.d1() ) ));
> return diff2<T>( r.d0() , r.d1(), ( a.d2() + a.d1()*a.d1())
*r.d0() );
> }
>
> But that does not scale for
> differential_number<N, double>::exp( x );

Good point. And it looks pretty bad, doesn't it?
As it happens, I personally only need the class up to order 2
and have a hard time envisioning anyone needing it for higher
order. Maybe we could just define the interface and leave the
implementation of higher order functions to users who actually
need them?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk