Boost logo

Boost :

From: boost (boost_at_[hidden])
Date: 2002-02-12 13:42:22


Salut,

On Tuesday 12 February 2002 18:08, deane_yang wrote:
> I took at look at your code; it's exactly what I want.
>
> Couldn't the library be implemented
> instead using the order of the Taylor series as a template
> parameter? The 0th, 1st, and 2nd order methods could
> be implemented explicitly using template specialization,
> and the Nth order could be implemented using general formulas.

That's exactly what I'm planning to do.
I have implemented a diff_ari_2 type, where I've tested the approach
of using the 1st order to calculate the second order.

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 );

Any suggestions ?
Best wishes,
Peter


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