I'm working with PolynomialFunction. I derivate/integrate my function f
in the next way:
// derivation ...
new PolynomialFunction(vector).value(x).getPartialDerivative(derivationOrder)
// integration ...
UnivariateIntegrator integrator = new IterativeLegendreGaussIntegrator(pointsNumber, relativeAccuracy, absoluteAccuracy, minIterations, maxIterations);
integrator.integrate(128, f, from, to);
But how to get derivation/integration result from function f
without specifying real values?
Ie derivate (8 + 3x + x^2) => 3 + 2x
I do not believe the Apache Math Commons Library supports symbolic derivation/integration. However, if you are using polynomials as your question implies, this is computationally easy enough. If you represent a polynomial as an array of coefficients like Apache does for their PolynomialFunction, this makes it pretty easy.
Derivative:
Integration:
Doing this for an arbitrary function becomes a lot harder, or sometimes even impossible. There are programs out there that are pretty good at this, such as SageMath. I would consult a calculus text for more information. I hope that helps!
For polynomial functions, you can get derivatives directly (as polynomials) using the polynomialDerivative
method of the PolynomialFunction
class. There is also a more general setup for differentiation described in the analysis section of the Commons Math User Guide.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.