
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.