Class DerivativeStructure
- java.lang.Object
-
- org.hipparchus.analysis.differentiation.DerivativeStructure
-
- All Implemented Interfaces:
Serializable,Derivative<DerivativeStructure>,DifferentialAlgebra,CalculusFieldElement<DerivativeStructure>,FieldElement<DerivativeStructure>
public class DerivativeStructure extends Object implements Derivative<DerivativeStructure>, Serializable
Class representing both the value and the differentials of a function.This class is the workhorse of the differentiation package.
This class is an implementation of the extension to Rall's numbers described in Dan Kalman's paper Doubly Recursive Multivariate Automatic Differentiation, Mathematics Magazine, vol. 75, no. 3, June 2002. Rall's numbers are an extension to the real numbers used throughout mathematical expressions; they hold the derivative together with the value of a function. Dan Kalman's derivative structures hold all partial derivatives up to any specified order, with respect to any number of free parameters. Rall's numbers therefore can be seen as derivative structures for order one derivative and one free parameter, and real numbers can be seen as derivative structures with zero order derivative and no free parameters.
DerivativeStructureinstances can be used directly thanks to the arithmetic operators to the mathematical functions provided as methods by this class (+, -, *, /, %, sin, cos ...).Implementing complex expressions by hand using
Derivative-based classes (or in fact anyCalculusFieldElementclass) is a tedious and error-prone task but has the advantage of not requiring users to compute the derivatives by themselves and allowing to switch for one derivative implementation to another as they all share the same filed API.Implementing complex expression can also be done by developing computation code using standard primitive double values and to use
differentiatorsto create theDerivativeStructure-based instances. This method is simpler but may be limited in the accuracy and derivation orders and may be computationally intensive (this is typically the case forfinite differences differentiator.Instances of this class are guaranteed to be immutable.
- See Also:
DSCompiler,FieldDerivativeStructure, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DerivativeStructureabs()absolute value.DerivativeStructureacos()Arc cosine operation.DerivativeStructureacosh()Inverse hyperbolic cosine operation.DerivativeStructureadd(DerivativeStructure a)Compute this + a.DerivativeStructureasin()Arc sine operation.DerivativeStructureasinh()Inverse hyperbolic sine operation.DerivativeStructureatan()Arc tangent operation.DerivativeStructureatan2(DerivativeStructure x)Two arguments arc tangent operation.static DerivativeStructureatan2(DerivativeStructure y, DerivativeStructure x)Two arguments arc tangent operation.DerivativeStructureatanh()Inverse hyperbolic tangent operation.DerivativeStructurecompose(double... f)Compute composition of the instance by a univariate function.DerivativeStructurecopySign(double sign)Returns the instance with the sign of the argument.DerivativeStructurecopySign(DerivativeStructure sign)Returns the instance with the sign of the argument.DerivativeStructurecos()Cosine operation.DerivativeStructurecosh()Hyperbolic cosine operation.DerivativeStructuredifferentiate(int varIndex, int differentiationOrder)Differentiate w.r.t. one independent variable.DerivativeStructuredivide(double a)'÷' operator.DerivativeStructuredivide(DerivativeStructure a)Compute this ÷ a.booleanequals(Object other)Test for the equality of two derivative structures.DerivativeStructureexp()Exponential.DerivativeStructureexpm1()Exponential minus 1.DerivativeStructuregetAddendum()Get the addendum to the real value of the number.double[]getAllDerivatives()Get all partial derivatives.DSFactorygetFactory()Get the factory that built the instance.Field<DerivativeStructure>getField()Get theFieldto which the instance belongs.intgetFreeParameters()Get the number of free parameters.intgetOrder()Get the maximum derivation order.doublegetPartialDerivative(int... orders)Get a partial derivative.DerivativeStructuregetPi()Get the Archimedes constant π.doublegetValue()Get the value part of the derivative structure.inthashCode()Get a hashCode for the derivative structure.DerivativeStructurehypot(DerivativeStructure y)Returns the hypotenuse of a triangle with sidesthisandy- sqrt(this2 +y2) avoiding intermediate overflow or underflow.static DerivativeStructurehypot(DerivativeStructure x, DerivativeStructure y)Returns the hypotenuse of a triangle with sidesxandy- sqrt(x2 +y2) avoiding intermediate overflow or underflow.DerivativeStructureintegrate(int varIndex, int integrationOrder)Integrate w.r.t. one independent variable.DerivativeStructurelinearCombination(double[] a, DerivativeStructure[] b)Compute a linear combination.DerivativeStructurelinearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2)Compute a linear combination.DerivativeStructurelinearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3)Compute a linear combination.DerivativeStructurelinearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3, double a4, DerivativeStructure b4)Compute a linear combination.DerivativeStructurelinearCombination(DerivativeStructure[] a, DerivativeStructure[] b)Compute a linear combination.DerivativeStructurelinearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2)Compute a linear combination.DerivativeStructurelinearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3)Compute a linear combination.DerivativeStructurelinearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3, DerivativeStructure a4, DerivativeStructure b4)Compute a linear combination.DerivativeStructurelog()Natural logarithm.DerivativeStructurelog10()Base 10 logarithm.DerivativeStructurelog1p()Shifted natural logarithm.DerivativeStructuremultiply(double a)'×' operator.DerivativeStructuremultiply(DerivativeStructure a)Compute this × a.DerivativeStructurenegate()Returns the additive inverse ofthiselement.DerivativeStructurenewInstance(double value)Create an instance corresponding to a constant real value.DerivativeStructurepow(double p)Power operation.static DerivativeStructurepow(double a, DerivativeStructure x)Compute ax where a is a double and x aDerivativeStructureDerivativeStructurepow(int n)Integer power operation.DerivativeStructurepow(DerivativeStructure e)Power operation.DerivativeStructurerebase(DerivativeStructure... p)Rebase instance with respect to low level parameter functions.DerivativeStructurereciprocal()Returns the multiplicative inverse ofthiselement.DerivativeStructureremainder(DerivativeStructure a)IEEE remainder operator.DerivativeStructurerootN(int n)Nth root.DerivativeStructurescalb(int n)Multiply the instance by a power of 2.DerivativeStructuresin()Sine operation.FieldSinCos<DerivativeStructure>sinCos()Combined Sine and Cosine operation.DerivativeStructuresinh()Hyperbolic sine operation.FieldSinhCosh<DerivativeStructure>sinhCosh()Combined hyperbolic sine and cosine operation.DerivativeStructuresqrt()Square root.DerivativeStructuresquare()Compute this × this.DerivativeStructuresubtract(DerivativeStructure a)Compute this - a.DerivativeStructuretan()Tangent operation.DerivativeStructuretanh()Hyperbolic tangent operation.doubletaylor(double... delta)Evaluate Taylor expansion a derivative structure.DerivativeStructuretoDegrees()Convert radians to degrees, with error of less than 0.5 ULPDerivativeStructuretoRadians()Convert degrees to radians, with error of less than 0.5 ULPDerivativeStructurewithValue(double value)Create a new object with new value (zeroth-order derivative, as passed as input) and same derivatives of order one and above.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hipparchus.CalculusFieldElement
cbrt, ceil, floor, isFinite, isInfinite, isNaN, multiply, norm, rint, round, sign, ulp
-
Methods inherited from interface org.hipparchus.analysis.differentiation.Derivative
add, getExponent, getReal, remainder, subtract
-
Methods inherited from interface org.hipparchus.FieldElement
isZero
-
-
-
-
Method Detail
-
newInstance
public DerivativeStructure newInstance(double value)
Create an instance corresponding to a constant real value.- Specified by:
newInstancein interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
value- constant real value- Returns:
- instance corresponding to a constant real value
-
withValue
public DerivativeStructure withValue(double value)
Create a new object with new value (zeroth-order derivative, as passed as input) and same derivatives of order one and above.This default implementation is there so that no API gets broken by the next release, which is not a major one. Custom inheritors should probably overwrite it.
- Specified by:
withValuein interfaceDerivative<DerivativeStructure>- Parameters:
value- zeroth-order derivative of new represented function- Returns:
- new object with changed value
-
getFactory
public DSFactory getFactory()
Get the factory that built the instance.- Returns:
- factory that built the instance
-
getFreeParameters
public int getFreeParameters()
Get the number of free parameters.- Specified by:
getFreeParametersin interfaceDifferentialAlgebra- Returns:
- number of free parameters
-
getOrder
public int getOrder()
Get the maximum derivation order.- Specified by:
getOrderin interfaceDifferentialAlgebra- Returns:
- maximum derivation order
-
getAddendum
public DerivativeStructure getAddendum()
Get the addendum to the real value of the number.The addendum is considered to be the part that when added back to the
real partrecovers the instance. This means that whene.getReal()is finite (i.e. neither infinite nor NaN), thene.getAddendum().add(e.getReal())iseande.subtract(e.getReal())ise.getAddendum(). Beware that for non-finite numbers, these two equalities may not hold. The first equality (with the addition), always holds even for infinity and NaNs if the real part is independent of the addendum (this is the case for all derivatives types, as well as for complex and Dfp, but it is not the case for Tuple and FieldTuple). The second equality (with the subtraction), generally doesn't hold for non-finite numbers, because the subtraction generates NaNs.- Specified by:
getAddendumin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- real value
-
getValue
public double getValue()
Get the value part of the derivative structure.- Specified by:
getValuein interfaceDerivative<DerivativeStructure>- Returns:
- value part of the derivative structure
- See Also:
getPartialDerivative(int...)
-
getPartialDerivative
public double getPartialDerivative(int... orders) throws MathIllegalArgumentExceptionGet a partial derivative.- Specified by:
getPartialDerivativein interfaceDerivative<DerivativeStructure>- Parameters:
orders- derivation orders with respect to each variable (if all orders are 0, the value is returned)- Returns:
- partial derivative
- Throws:
MathIllegalArgumentException- if the numbers of variables does not match the instance- See Also:
Derivative.getValue()
-
getAllDerivatives
public double[] getAllDerivatives()
Get all partial derivatives.- Returns:
- a fresh copy of partial derivatives, in an array sorted according to
DSCompiler.getPartialDerivativeIndex(int...)
-
add
public DerivativeStructure add(DerivativeStructure a) throws MathIllegalArgumentException
Compute this + a.- Specified by:
addin interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to add- Returns:
- a new element representing this + a
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
subtract
public DerivativeStructure subtract(DerivativeStructure a) throws MathIllegalArgumentException
Compute this - a.- Specified by:
subtractin interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
subtractin interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to subtract- Returns:
- a new element representing this - a
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
multiply
public DerivativeStructure multiply(double a)
'×' operator.- Specified by:
multiplyin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this×a
-
multiply
public DerivativeStructure multiply(DerivativeStructure a) throws MathIllegalArgumentException
Compute this × a.- Specified by:
multiplyin interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to multiply- Returns:
- a new element representing this × a
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
square
public DerivativeStructure square()
Compute this × this.- Specified by:
squarein interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- a new element representing this × this
-
divide
public DerivativeStructure divide(double a)
'÷' operator.- Specified by:
dividein interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this÷a
-
divide
public DerivativeStructure divide(DerivativeStructure a) throws MathIllegalArgumentException
Compute this ÷ a.- Specified by:
dividein interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
dividein interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to divide by- Returns:
- a new element representing this ÷ a
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
remainder
public DerivativeStructure remainder(DerivativeStructure a) throws MathIllegalArgumentException
IEEE remainder operator.- Specified by:
remainderin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this - n × a where n is the closest integer to this/a
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
negate
public DerivativeStructure negate()
Returns the additive inverse ofthiselement.- Specified by:
negatein interfaceFieldElement<DerivativeStructure>- Returns:
- the opposite of
this.
-
abs
public DerivativeStructure abs()
absolute value.- Specified by:
absin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- abs(this)
-
copySign
public DerivativeStructure copySign(DerivativeStructure sign)
Returns the instance with the sign of the argument. A NaNsignargument is treated as positive.- Specified by:
copySignin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
sign- the sign for the returned value- Returns:
- the instance with the same sign as the
signargument
-
copySign
public DerivativeStructure copySign(double sign)
Returns the instance with the sign of the argument. A NaNsignargument is treated as positive.- Specified by:
copySignin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
sign- the sign for the returned value- Returns:
- the instance with the same sign as the
signargument
-
scalb
public DerivativeStructure scalb(int n)
Multiply the instance by a power of 2.- Specified by:
scalbin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
n- power of 2- Returns:
- this × 2n
-
hypot
public DerivativeStructure hypot(DerivativeStructure y) throws MathIllegalArgumentException
Returns the hypotenuse of a triangle with sidesthisandy- sqrt(this2 +y2) avoiding intermediate overflow or underflow.- If either argument is infinite, then the result is positive infinity.
- else, if either argument is NaN then the result is NaN.
- Specified by:
hypotin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
y- a value- Returns:
- sqrt(this2 +y2)
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
hypot
public static DerivativeStructure hypot(DerivativeStructure x, DerivativeStructure y) throws MathIllegalArgumentException
Returns the hypotenuse of a triangle with sidesxandy- sqrt(x2 +y2) avoiding intermediate overflow or underflow.- If either argument is infinite, then the result is positive infinity.
- else, if either argument is NaN then the result is NaN.
- Parameters:
x- a valuey- a value- Returns:
- sqrt(x2 +y2)
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
compose
public DerivativeStructure compose(double... f) throws MathIllegalArgumentException
Compute composition of the instance by a univariate function.- Specified by:
composein interfaceDerivative<DerivativeStructure>- Parameters:
f- array of value and derivatives of the function at the current point (i.e. [f(getValue()), f'(getValue()), f''(getValue())...]).- Returns:
- f(this)
- Throws:
MathIllegalArgumentException- if the number of derivatives in the array is not equal toorder+ 1
-
reciprocal
public DerivativeStructure reciprocal()
Returns the multiplicative inverse ofthiselement.- Specified by:
reciprocalin interfaceFieldElement<DerivativeStructure>- Returns:
- the inverse of
this.
-
sqrt
public DerivativeStructure sqrt()
Square root.- Specified by:
sqrtin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- square root of the instance
-
rootN
public DerivativeStructure rootN(int n)
Nth root.- Specified by:
rootNin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
n- order of the root- Returns:
- nth root of the instance
-
getField
public Field<DerivativeStructure> getField()
Get theFieldto which the instance belongs.- Specified by:
getFieldin interfaceFieldElement<DerivativeStructure>- Returns:
Fieldto which the instance belongs
-
pow
public static DerivativeStructure pow(double a, DerivativeStructure x)
Compute ax where a is a double and x aDerivativeStructure- Parameters:
a- number to exponentiatex- power to apply- Returns:
- ax
-
pow
public DerivativeStructure pow(double p)
Power operation.- Specified by:
powin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
p- power to apply- Returns:
- thisp
-
pow
public DerivativeStructure pow(int n)
Integer power operation.- Specified by:
powin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
n- power to apply- Returns:
- thisn
-
pow
public DerivativeStructure pow(DerivativeStructure e) throws MathIllegalArgumentException
Power operation.- Specified by:
powin interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
powin interfaceDerivative<DerivativeStructure>- Parameters:
e- exponent- Returns:
- thise
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
exp
public DerivativeStructure exp()
Exponential.- Specified by:
expin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- exponential of the instance
-
expm1
public DerivativeStructure expm1()
Exponential minus 1.- Specified by:
expm1in interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- exponential minus one of the instance
-
log
public DerivativeStructure log()
Natural logarithm.- Specified by:
login interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- logarithm of the instance
-
log1p
public DerivativeStructure log1p()
Shifted natural logarithm.- Specified by:
log1pin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- logarithm of one plus the instance
-
log10
public DerivativeStructure log10()
Base 10 logarithm.- Specified by:
log10in interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
log10in interfaceDerivative<DerivativeStructure>- Returns:
- base 10 logarithm of the instance
-
cos
public DerivativeStructure cos()
Cosine operation.- Specified by:
cosin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- cos(this)
-
sin
public DerivativeStructure sin()
Sine operation.- Specified by:
sinin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- sin(this)
-
sinCos
public FieldSinCos<DerivativeStructure> sinCos()
Combined Sine and Cosine operation.- Specified by:
sinCosin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- [sin(this), cos(this)]
-
tan
public DerivativeStructure tan()
Tangent operation.- Specified by:
tanin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- tan(this)
-
acos
public DerivativeStructure acos()
Arc cosine operation.- Specified by:
acosin interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
acosin interfaceDerivative<DerivativeStructure>- Returns:
- acos(this)
-
asin
public DerivativeStructure asin()
Arc sine operation.- Specified by:
asinin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- asin(this)
-
atan
public DerivativeStructure atan()
Arc tangent operation.- Specified by:
atanin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- atan(this)
-
atan2
public DerivativeStructure atan2(DerivativeStructure x) throws MathIllegalArgumentException
Two arguments arc tangent operation.Beware of the order or arguments! As this is based on a two-arguments functions, in order to be consistent with arguments order, the instance is the first argument and the single provided argument is the second argument. In order to be consistent with programming languages
atan2, this method computesatan2(this, x), i.e. the instance represents theyargument and thexargument is the one passed as a single argument. This may seem confusing especially for users of Wolfram alpha, as this site is not consistent with programming languagesatan2two-arguments arc tangent and putsxas its first argument.- Specified by:
atan2in interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
x- second argument of the arc tangent- Returns:
- atan2(this, x)
- Throws:
MathIllegalArgumentException- if number of free parameters or orders are inconsistent
-
atan2
public static DerivativeStructure atan2(DerivativeStructure y, DerivativeStructure x) throws MathIllegalArgumentException
Two arguments arc tangent operation.- Parameters:
y- first argument of the arc tangentx- second argument of the arc tangent- Returns:
- atan2(y, x)
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
cosh
public DerivativeStructure cosh()
Hyperbolic cosine operation.- Specified by:
coshin interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
coshin interfaceDerivative<DerivativeStructure>- Returns:
- cosh(this)
-
sinh
public DerivativeStructure sinh()
Hyperbolic sine operation.- Specified by:
sinhin interfaceCalculusFieldElement<DerivativeStructure>- Specified by:
sinhin interfaceDerivative<DerivativeStructure>- Returns:
- sinh(this)
-
sinhCosh
public FieldSinhCosh<DerivativeStructure> sinhCosh()
Combined hyperbolic sine and cosine operation.- Specified by:
sinhCoshin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- [sinh(this), cosh(this)]
-
tanh
public DerivativeStructure tanh()
Hyperbolic tangent operation.- Specified by:
tanhin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- tanh(this)
-
acosh
public DerivativeStructure acosh()
Inverse hyperbolic cosine operation.- Specified by:
acoshin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- acosh(this)
-
asinh
public DerivativeStructure asinh()
Inverse hyperbolic sine operation.- Specified by:
asinhin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- asin(this)
-
atanh
public DerivativeStructure atanh()
Inverse hyperbolic tangent operation.- Specified by:
atanhin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- atanh(this)
-
toDegrees
public DerivativeStructure toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP- Specified by:
toDegreesin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- instance converted into degrees
-
toRadians
public DerivativeStructure toRadians()
Convert degrees to radians, with error of less than 0.5 ULP- Specified by:
toRadiansin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- instance converted into radians
-
integrate
public DerivativeStructure integrate(int varIndex, int integrationOrder)
Integrate w.r.t. one independent variable.Rigorously, if the derivatives of a function are known up to order N, the ones of its M-th integral w.r.t. a given variable (seen as a function itself) are actually known up to order N+M. However, this method still casts the output as a DerivativeStructure of order N. The integration constants are systematically set to zero.
- Parameters:
varIndex- Index of independent variable w.r.t. which integration is done.integrationOrder- Number of times the integration operator must be applied. If non-positive, call the differentiation operator.- Returns:
- DerivativeStructure on which integration operator has been applied a certain number of times.
- Since:
- 2.2
-
differentiate
public DerivativeStructure differentiate(int varIndex, int differentiationOrder)
Differentiate w.r.t. one independent variable.Rigorously, if the derivatives of a function are known up to order N, the ones of its M-th derivative w.r.t. a given variable (seen as a function itself) are only known up to order N-M. However, this method still casts the output as a DerivativeStructure of order N with zeroes for the higher order terms.
- Parameters:
varIndex- Index of independent variable w.r.t. which differentiation is done.differentiationOrder- Number of times the differentiation operator must be applied. If non-positive, call the integration operator instead.- Returns:
- DerivativeStructure on which differentiation operator has been applied a certain number of times
- Since:
- 2.2
-
taylor
public double taylor(double... delta) throws MathRuntimeExceptionEvaluate Taylor expansion a derivative structure.- Parameters:
delta- parameters offsets (Δx, Δy, ...)- Returns:
- value of the Taylor expansion at x + Δx, y + Δy, ...
- Throws:
MathRuntimeException- if factorials becomes too large
-
rebase
public DerivativeStructure rebase(DerivativeStructure... p)
Rebase instance with respect to low level parameter functions.The instance is considered to be a function of
\( \begin{align} p_0 & = p_0(q_0, q_1, \ldots q_{m-1})\\ p_1 & = p_1(q_0, q_1, \ldots q_{m-1})\\ p_{n-1} & = p_{n-1}(q_0, q_1, \ldots q_{m-1}) \end{align}\)n free parametersup to ordero\(f(p_0, p_1, \ldots p_{n-1})\). Itspartial derivativesare therefore \(f, \frac{\partial f}{\partial p_0}, \frac{\partial f}{\partial p_1}, \ldots \frac{\partial^2 f}{\partial p_0^2}, \frac{\partial^2 f}{\partial p_0 p_1}, \ldots \frac{\partial^o f}{\partial p_{n-1}^o}\). The free parameters \(p_0, p_1, \ldots p_{n-1}\) are considered to be functions of \(m\) lower level other parameters \(q_0, q_1, \ldots q_{m-1}\).This method compute the composition of the partial derivatives of \(f\) and the partial derivatives of \(p_0, p_1, \ldots p_{n-1}\), i.e. the
partial derivativesof the value returned will be \(f, \frac{\partial f}{\partial q_0}, \frac{\partial f}{\partial q_1}, \ldots \frac{\partial^2 f}{\partial q_0^2}, \frac{\partial^2 f}{\partial q_0 q_1}, \ldots \frac{\partial^o f}{\partial q_{m-1}^o}\).The number of parameters must match
getFreeParameters()and the derivation orders of the instance and parameters must also match.- Parameters:
p- base parameters with respect to which partial derivatives were computed in the instance- Returns:
- derivative structure with partial derivatives computed with respect to the lower level parameters used in the \(p_i\)
- Since:
- 2.2
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure[] a, DerivativeStructure[] b) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a- Factors.b- Factors.- Returns:
Σi ai bi.- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
linearCombination
public DerivativeStructure linearCombination(double[] a, DerivativeStructure[] b) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a- Factors.b- Factors.- Returns:
Σi ai bi.- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a1- first factor of the first termb1- second factor of the first terma2- first factor of the second termb2- second factor of the second term- Returns:
- a1×b1 + a2×b2
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match- See Also:
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement),CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a1- first factor of the first termb1- second factor of the first terma2- first factor of the second termb2- second factor of the second term- Returns:
- a1×b1 + a2×b2
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match- See Also:
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement),CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement, double, FieldElement)
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a1- first factor of the first termb1- second factor of the first terma2- first factor of the second termb2- second factor of the second terma3- first factor of the third termb3- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match- See Also:
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement),CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a1- first factor of the first termb1- second factor of the first terma2- first factor of the second termb2- second factor of the second terma3- first factor of the third termb3- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match- See Also:
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement),CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement, double, FieldElement)
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3, DerivativeStructure a4, DerivativeStructure b4) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a1- first factor of the first termb1- second factor of the first terma2- first factor of the second termb2- second factor of the second terma3- first factor of the third termb3- second factor of the third terma4- first factor of the fourth termb4- second factor of the fourth term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match- See Also:
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement),CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3, double a4, DerivativeStructure b4) throws MathIllegalArgumentException
Compute a linear combination.- Specified by:
linearCombinationin interfaceCalculusFieldElement<DerivativeStructure>- Parameters:
a1- first factor of the first termb1- second factor of the first terma2- first factor of the second termb2- second factor of the second terma3- first factor of the third termb3- second factor of the third terma4- first factor of the fourth termb4- second factor of the fourth term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- Throws:
MathIllegalArgumentException- if number of free parameters or orders do not match- See Also:
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement),CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement)
-
getPi
public DerivativeStructure getPi()
Get the Archimedes constant π.Archimedes constant is the ratio of a circle's circumference to its diameter.
- Specified by:
getPiin interfaceCalculusFieldElement<DerivativeStructure>- Returns:
- Archimedes constant π
-
equals
public boolean equals(Object other)
Test for the equality of two derivative structures.Derivative structures are considered equal if they have the same number of free parameters, the same derivation order, and the same derivatives.
-
-