2

I've been searching for a C/C++ library that does symbolic differantation and integrals of polynoms, but haven't found one that suits my needs. I'm afraid that the problem is that I'm not using the correct terminology. The problem is this :

given a polynom p, I would like to look at the function

f(p) = integral of (p')^2 from a to b

And generate partial derivatives for f with respect to p's coefficients.

Theoretically, there should be no problem here as we are dealing with polynoms, but I haven't found something that can keep the connection between the original coefficients and the modified polynom.

Does anyone know if there are libraries that can do such things, or am I better of creating my own?

Noam
  • 23
  • 2

2 Answers2

2

Have you tried to use http://www.fadbad.com/fadbad.html ? It's quite useful.

deephace
  • 324
  • 3
  • 15
0

I would write my own derivative class. There are books available meanwhile which document how to do this. But assuming you know the math rules, it is rather trivial. Using such a derivative class you can then write a template function to generate your polynomial and the derivative and the square and the integral while keeping track of the derivatives vs. the coefficients. The problem is that you may carry around a lot of derivatives which are always zero. To avoid this is rather complicated. A normal derivative class would contain a value and an array of derivative values. There may be a constructor to create an independent variable by value and index -- initializing the value by the passed value and all derivatives to zero except the one matching the index to 1. Then you write operators and functions for everything you need -- which is not much assuming you're only dealing with polynomials.