Re: [boost] [math] Does any one interesting in calculating derivative for a expression automatically?

Hi John, 1. I have tried that if you write d(d(d(d(x*x*x*x, x), x), x), x), it will take a long compile time without optimized. I have do something to optimized it. I need to write a lot of specialized template class for most of the operators. 2. Because of the C++ grammar, I think it can just accept expression like C++ style. think about operator^, the priority is lower in C++ than in math. 3. As I said, high derivative will cost lots of compile time without "simplify", so you are right, the expression should be simplified. but at compile time, it is a little difficult to do it, but I'll do my best to optimized it. Dongfei.
Good idea, and this is all very neat, but I see a couple of issues:
1) Compile times for a compile time derivative is likely to be slow? 2) Isn't it easier to just calculate the derivative within a symbolic math package and then cut and paste the result into your code (Yacas is free for example)? 3) What happens for very complex expressions? Can the compile time code simplify the resulting derivative so that it is optimally evaluated? Most symbolic math packages will have a "simplify" function that does just that, without it, code might be very inefficient to evaluate, with it, compile times might be way too long :-(
Regards, John.

Dongfei Yin a écrit :
Hi John, 1. I have tried that if you write d(d(d(d(x*x*x*x, x), x), x), x), it will take a long compile time without optimized. I have do something to optimized it. I need to write a lot of specialized Can't this be mapped onto a d<N>(f,v) function that is optimized for N = 1,2,3,... ? I bet that if you use proto, matching d(d(d( ... )))) and repalcing by d<N>(...) should be easy.
Do you perform your derivation recursively on the derivative degree (ie d(d(x*x,x),x) is y = d(x*x,x); d(y,x);) If yes, you may want to use coarser grain. Let's say you specialized d() d<2>() and d<3>() for ex. Computing d<5> is d<2>(d<3>()) instead of d(d(d(d(d()))). Of course, using d,d2, d4 is maybe a better option so you cna use bit representaiton of derivative degree to find how to combine the derivative.
participants (2)
-
Dongfei Yin
-
Joel Falcou