[英]Apache Commons Math: get derivate/integrate function
I'm working with PolynomialFunction. 我正在使用PolynomialFunction。 I derivate/integrate my function
f
in the next way: 我通过以下方式派生/集成我的函数
f
:
// 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? 但是,如何在不指定实际值的情况下从函数
f
获取推导/积分结果呢?
Ie derivate (8 + 3x + x^2) => 3 + 2x 即导数(8 + 3x + x ^ 2)=> 3 + 2x
I do not believe the Apache Math Commons Library supports symbolic derivation/integration. 我不认为Apache Math Commons库支持符号派生/集成。 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.
如果将多项式表示为系数数组,就像Apache为其PolynomialFunction所做的那样,这将非常容易。
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.
有一些非常擅长此功能的程序,例如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. 对于多项式函数,可以使用
PolynomialFunction
类的polynomialDerivative
方法直接获得导数(作为多项式)。 There is also a more general setup for differentiation described in the analysis section of the Commons Math User Guide. 在Commons Math用户指南的分析部分中介绍了用于区分的更通用的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.