Class DerivativeStructure
- java.lang.Object
-
- org.apache.commons.math4.legacy.analysis.differentiation.DerivativeStructure
-
- All Implemented Interfaces:
FieldElement<DerivativeStructure>,RealFieldElement<DerivativeStructure>
public class DerivativeStructure extends Object implements RealFieldElement<DerivativeStructure>
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 these classes is a tedious and error-prone task but has the advantage of having no limitation on the derivation order despite not requiring users to compute the derivatives by themselves. 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.
- Since:
- 3.1
- See Also:
DSCompiler
-
-
Constructor Summary
Constructors Constructor Description DerivativeStructure(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2)Linear combination constructor.DerivativeStructure(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2, double a3, DerivativeStructure ds3)Linear combination constructor.DerivativeStructure(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2, double a3, DerivativeStructure ds3, double a4, DerivativeStructure ds4)Linear combination constructor.DerivativeStructure(int parameters, int order)Build an instance with all values and derivatives set to 0.DerivativeStructure(int parameters, int order, double value)Build an instance representing a constant value.DerivativeStructure(int parameters, int order, double... derivatives)Build an instance from all its derivatives.DerivativeStructure(int parameters, int order, int index, double value)Build an instance representing a variable.
-
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(double a)'+' operator.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.DerivativeStructurecbrt()Cubic root.DerivativeStructureceil()Get the smallest whole number larger than instance.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.DerivativeStructurecreateConstant(double c)Create a constant compatible with instance order and number of parameters.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.DerivativeStructurefloor()Get the largest whole number smaller than instance.double[]getAllDerivatives()Get all partial derivatives.intgetExponent()Return the exponent of the instance value, removing the bias.Field<DerivativeStructure>getField()Get theFieldto which the instance belongs.intgetFreeParameters()Get the number of free parameters.intgetOrder()Get the derivation order.doublegetPartialDerivative(int... orders)Get a partial derivative.doublegetReal()Get the real value of the number.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.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(int n)Compute n × this.DerivativeStructuremultiply(DerivativeStructure a)Compute this × a.DerivativeStructurenegate()Returns the additive inverse ofthiselement.DerivativeStructurepow(double p)Power operation.static DerivativeStructurepow(double a, DerivativeStructure x)Compute ax where a is a double and x aDerivativeStructure.DerivativeStructurepow(int n)Integer power operation.DerivativeStructurepow(DerivativeStructure e)Power operation.DerivativeStructurereciprocal()Returns the multiplicative inverse ofthiselement.DerivativeStructureremainder(double a)IEEE remainder operator.DerivativeStructureremainder(DerivativeStructure a)IEEE remainder operator.DerivativeStructurerint()Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.DerivativeStructurerootN(int n)Nth root.longround()Get the closest long to instance value.DerivativeStructurescalb(int n)Multiply the instance by a power of 2.DerivativeStructuresignum()Compute the signum of the instance.DerivativeStructuresin()Sine operation.DerivativeStructuresinh()Hyperbolic sine operation.DerivativeStructuresqrt()Square root.DerivativeStructuresubtract(double a)'-' operator.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 ULP.DerivativeStructuretoRadians()Convert degrees to radians, with error of less than 0.5 ULP.
-
-
-
Constructor Detail
-
DerivativeStructure
public DerivativeStructure(int parameters, int order)
Build an instance with all values and derivatives set to 0.- Parameters:
parameters- number of free parametersorder- derivation order- Throws:
NumberIsTooLargeException- if order is too large.
-
DerivativeStructure
public DerivativeStructure(int parameters, int order, double value)
Build an instance representing a constant value.- Parameters:
parameters- number of free parametersorder- derivation ordervalue- value of the constant- Throws:
NumberIsTooLargeException- if order is too large.- See Also:
DerivativeStructure(int, int, int, double)
-
DerivativeStructure
public DerivativeStructure(int parameters, int order, int index, double value)
Build an instance representing a variable.Instances built using this constructor are considered to be the free variables with respect to which differentials are computed. As such, their differential with respect to themselves is +1.
- Parameters:
parameters- number of free parametersorder- derivation orderindex- index of the variable (from 0 toparameters - 1)value- value of the variable- Throws:
NumberIsTooLargeException- ifindex ≥ parameters.- See Also:
DerivativeStructure(int, int, double)
-
DerivativeStructure
public DerivativeStructure(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2)
Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2- Parameters:
a1- first scale factords1- first base (unscaled) derivative structurea2- second scale factords2- second base (unscaled) derivative structure- Throws:
DimensionMismatchException- if number of free parameters or orders are inconsistent
-
DerivativeStructure
public DerivativeStructure(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2, double a3, DerivativeStructure ds3)
Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3- Parameters:
a1- first scale factords1- first base (unscaled) derivative structurea2- second scale factords2- second base (unscaled) derivative structurea3- third scale factords3- third base (unscaled) derivative structure- Throws:
DimensionMismatchException- if number of free parameters or orders are inconsistent.
-
DerivativeStructure
public DerivativeStructure(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2, double a3, DerivativeStructure ds3, double a4, DerivativeStructure ds4)
Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4- Parameters:
a1- first scale factords1- first base (unscaled) derivative structurea2- second scale factords2- second base (unscaled) derivative structurea3- third scale factords3- third base (unscaled) derivative structurea4- fourth scale factords4- fourth base (unscaled) derivative structure- Throws:
DimensionMismatchException- if number of free parameters or orders are inconsistent.
-
DerivativeStructure
public DerivativeStructure(int parameters, int order, double... derivatives)
Build an instance from all its derivatives.- Parameters:
parameters- number of free parametersorder- derivation orderderivatives- derivatives sorted according toDSCompiler.getPartialDerivativeIndex(int...)- Throws:
DimensionMismatchException- if derivatives array does not match thesizeexpected by the compiler.NumberIsTooLargeException- if order is too large.- See Also:
getAllDerivatives()
-
-
Method Detail
-
getFreeParameters
public int getFreeParameters()
Get the number of free parameters.- Returns:
- number of free parameters
-
getOrder
public int getOrder()
Get the derivation order.- Returns:
- derivation order
-
createConstant
public DerivativeStructure createConstant(double c)
Create a constant compatible with instance order and number of parameters.This method is a convenience factory method, it simply calls
new DerivativeStructure(getFreeParameters(), getOrder(), c)- Parameters:
c- value of the constant- Returns:
- a constant compatible with instance order and number of parameters
- Since:
- 3.3
- See Also:
DerivativeStructure(int, int, double)
-
getReal
public double getReal()
Get the real value of the number.- Specified by:
getRealin interfaceRealFieldElement<DerivativeStructure>- Returns:
- real value
- Since:
- 3.2
-
getValue
public double getValue()
Get the value part of the derivative structure.- Returns:
- value part of the derivative structure
- See Also:
getPartialDerivative(int...)
-
getPartialDerivative
public double getPartialDerivative(int... orders)
Get a partial derivative.- Parameters:
orders- derivation orders with respect to each variable (if all orders are 0, the value is returned)- Returns:
- partial derivative
- Throws:
DimensionMismatchException- if the numbers of variables does not match the instance.NumberIsTooLargeException- if the sum of derivation orders is larger than the instance limits.- See Also:
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(double a)
'+' operator.- Specified by:
addin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this+a
- Since:
- 3.2
-
add
public DerivativeStructure add(DerivativeStructure a)
Compute this + a.- Specified by:
addin interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to add- Returns:
- a new element representing this + a
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match.
-
subtract
public DerivativeStructure subtract(double a)
'-' operator.- Specified by:
subtractin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this-a
- Since:
- 3.2
-
subtract
public DerivativeStructure subtract(DerivativeStructure a)
Compute this - a.- Specified by:
subtractin interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to subtract- Returns:
- a new element representing this - a
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match
-
multiply
public DerivativeStructure multiply(int n)
Compute n × this. Multiplication by an integer number is defined as the following sum:n × this = ∑i=1n this.
- Specified by:
multiplyin interfaceFieldElement<DerivativeStructure>- Parameters:
n- Number of timesthismust be added to itself.- Returns:
- A new element representing n × this.
-
multiply
public DerivativeStructure multiply(double a)
'×' operator.- Specified by:
multiplyin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this×a
- Since:
- 3.2
-
multiply
public DerivativeStructure multiply(DerivativeStructure a)
Compute this × a.- Specified by:
multiplyin interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to multiply- Returns:
- a new element representing this × a
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match
-
divide
public DerivativeStructure divide(double a)
'÷' operator.- Specified by:
dividein interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this÷a
- Since:
- 3.2
-
divide
public DerivativeStructure divide(DerivativeStructure a)
Compute this ÷ a.- Specified by:
dividein interfaceFieldElement<DerivativeStructure>- Parameters:
a- element to divide by- Returns:
- a new element representing this ÷ a
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match
-
remainder
public DerivativeStructure remainder(double a)
IEEE remainder operator.- Specified by:
remainderin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this - n × a where n is the closest integer to this/a (the even integer is chosen for n if this/a is halfway between two integers)
-
remainder
public DerivativeStructure remainder(DerivativeStructure a)
IEEE remainder operator.- Specified by:
remainderin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- right hand side parameter of the operator- Returns:
- this - n × a where n is the closest integer to this/a (the even integer is chosen for n if this/a is halfway between two integers)
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
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 interfaceRealFieldElement<DerivativeStructure>- Returns:
- abs(this)
- Since:
- 3.2
-
ceil
public DerivativeStructure ceil()
Get the smallest whole number larger than instance.- Specified by:
ceilin interfaceRealFieldElement<DerivativeStructure>- Returns:
- ceil(this)
- Since:
- 3.2
-
floor
public DerivativeStructure floor()
Get the largest whole number smaller than instance.- Specified by:
floorin interfaceRealFieldElement<DerivativeStructure>- Returns:
- floor(this)
- Since:
- 3.2
-
rint
public DerivativeStructure rint()
Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.- Specified by:
rintin interfaceRealFieldElement<DerivativeStructure>- Returns:
- a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5
- Since:
- 3.2
-
round
public long round()
Get the closest long to instance value.- Specified by:
roundin interfaceRealFieldElement<DerivativeStructure>- Returns:
- closest long to
RealFieldElement.getReal()
-
signum
public DerivativeStructure signum()
Compute the signum of the instance. The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise- Specified by:
signumin interfaceRealFieldElement<DerivativeStructure>- Returns:
- -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
- Since:
- 3.2
-
copySign
public DerivativeStructure copySign(DerivativeStructure sign)
Returns the instance with the sign of the argument. A NaNsignargument is treated as positive.- Specified by:
copySignin interfaceRealFieldElement<DerivativeStructure>- Parameters:
sign- the sign for the returned value- Returns:
- the instance with the same sign as the
signargument - Since:
- 3.2
-
copySign
public DerivativeStructure copySign(double sign)
Returns the instance with the sign of the argument. A NaNsignargument is treated as positive.- Specified by:
copySignin interfaceRealFieldElement<DerivativeStructure>- Parameters:
sign- the sign for the returned value- Returns:
- the instance with the same sign as the
signargument - Since:
- 3.2
-
getExponent
public int getExponent()
Return the exponent of the instance value, removing the bias.For double numbers of the form 2x, the unbiased exponent is exactly x.
- Returns:
- exponent for instance in IEEE754 representation, without bias
-
scalb
public DerivativeStructure scalb(int n)
Multiply the instance by a power of 2.- Specified by:
scalbin interfaceRealFieldElement<DerivativeStructure>- Parameters:
n- power of 2- Returns:
- this × 2n
- Since:
- 3.2
-
hypot
public DerivativeStructure hypot(DerivativeStructure y)
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 interfaceRealFieldElement<DerivativeStructure>- Parameters:
y- a value- Returns:
- sqrt(this2 +y2)
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
hypot
public static DerivativeStructure hypot(DerivativeStructure x, DerivativeStructure y)
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:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
compose
public DerivativeStructure compose(double... f)
Compute composition of the instance by a univariate function.- 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:
DimensionMismatchException- 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>- Specified by:
reciprocalin interfaceRealFieldElement<DerivativeStructure>- Returns:
- the inverse of
this.
-
sqrt
public DerivativeStructure sqrt()
Square root.- Specified by:
sqrtin interfaceRealFieldElement<DerivativeStructure>- Returns:
- square root of the instance
- Since:
- 3.2
-
cbrt
public DerivativeStructure cbrt()
Cubic root.- Specified by:
cbrtin interfaceRealFieldElement<DerivativeStructure>- Returns:
- cubic root of the instance
- Since:
- 3.2
-
rootN
public DerivativeStructure rootN(int n)
Nth root.- Specified by:
rootNin interfaceRealFieldElement<DerivativeStructure>- Parameters:
n- order of the root- Returns:
- nth root of the instance
- Since:
- 3.2
-
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
- Since:
- 3.3
-
pow
public DerivativeStructure pow(double p)
Power operation.- Specified by:
powin interfaceRealFieldElement<DerivativeStructure>- Parameters:
p- power to apply- Returns:
- thisp
- Since:
- 3.2
-
pow
public DerivativeStructure pow(int n)
Integer power operation.- Specified by:
powin interfaceRealFieldElement<DerivativeStructure>- Parameters:
n- power to apply- Returns:
- thisn
- Since:
- 3.2
-
pow
public DerivativeStructure pow(DerivativeStructure e)
Power operation.- Specified by:
powin interfaceRealFieldElement<DerivativeStructure>- Parameters:
e- exponent- Returns:
- thise
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
exp
public DerivativeStructure exp()
Exponential.- Specified by:
expin interfaceRealFieldElement<DerivativeStructure>- Returns:
- exponential of the instance
- Since:
- 3.2
-
expm1
public DerivativeStructure expm1()
Exponential minus 1.- Specified by:
expm1in interfaceRealFieldElement<DerivativeStructure>- Returns:
- exponential minus one of the instance
- Since:
- 3.2
-
log
public DerivativeStructure log()
Natural logarithm.- Specified by:
login interfaceRealFieldElement<DerivativeStructure>- Returns:
- logarithm of the instance
- Since:
- 3.2
-
log1p
public DerivativeStructure log1p()
Shifted natural logarithm.- Specified by:
log1pin interfaceRealFieldElement<DerivativeStructure>- Returns:
- logarithm of one plus the instance
- Since:
- 3.2
-
log10
public DerivativeStructure log10()
Base 10 logarithm.- Specified by:
log10in interfaceRealFieldElement<DerivativeStructure>- Returns:
- base 10 logarithm of the instance
-
cos
public DerivativeStructure cos()
Cosine operation.- Specified by:
cosin interfaceRealFieldElement<DerivativeStructure>- Returns:
- cos(this)
- Since:
- 3.2
-
sin
public DerivativeStructure sin()
Sine operation.- Specified by:
sinin interfaceRealFieldElement<DerivativeStructure>- Returns:
- sin(this)
- Since:
- 3.2
-
tan
public DerivativeStructure tan()
Tangent operation.- Specified by:
tanin interfaceRealFieldElement<DerivativeStructure>- Returns:
- tan(this)
- Since:
- 3.2
-
acos
public DerivativeStructure acos()
Arc cosine operation.- Specified by:
acosin interfaceRealFieldElement<DerivativeStructure>- Returns:
- acos(this)
- Since:
- 3.2
-
asin
public DerivativeStructure asin()
Arc sine operation.- Specified by:
asinin interfaceRealFieldElement<DerivativeStructure>- Returns:
- asin(this)
- Since:
- 3.2
-
atan
public DerivativeStructure atan()
Arc tangent operation.- Specified by:
atanin interfaceRealFieldElement<DerivativeStructure>- Returns:
- atan(this)
- Since:
- 3.2
-
atan2
public DerivativeStructure atan2(DerivativeStructure x)
Two arguments arc tangent operation.- Specified by:
atan2in interfaceRealFieldElement<DerivativeStructure>- Parameters:
x- second argument of the arc tangent- Returns:
- atan2(this, x)
- Since:
- 3.2
-
atan2
public static DerivativeStructure atan2(DerivativeStructure y, DerivativeStructure x)
Two arguments arc tangent operation.- Parameters:
y- first argument of the arc tangentx- second argument of the arc tangent- Returns:
- atan2(y, x)
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
cosh
public DerivativeStructure cosh()
Hyperbolic cosine operation.- Specified by:
coshin interfaceRealFieldElement<DerivativeStructure>- Returns:
- cosh(this)
- Since:
- 3.2
-
sinh
public DerivativeStructure sinh()
Hyperbolic sine operation.- Specified by:
sinhin interfaceRealFieldElement<DerivativeStructure>- Returns:
- sinh(this)
- Since:
- 3.2
-
tanh
public DerivativeStructure tanh()
Hyperbolic tangent operation.- Specified by:
tanhin interfaceRealFieldElement<DerivativeStructure>- Returns:
- tanh(this)
- Since:
- 3.2
-
acosh
public DerivativeStructure acosh()
Inverse hyperbolic cosine operation.- Specified by:
acoshin interfaceRealFieldElement<DerivativeStructure>- Returns:
- acosh(this)
- Since:
- 3.2
-
asinh
public DerivativeStructure asinh()
Inverse hyperbolic sine operation.- Specified by:
asinhin interfaceRealFieldElement<DerivativeStructure>- Returns:
- asin(this)
- Since:
- 3.2
-
atanh
public DerivativeStructure atanh()
Inverse hyperbolic tangent operation.- Specified by:
atanhin interfaceRealFieldElement<DerivativeStructure>- Returns:
- atanh(this)
- Since:
- 3.2
-
toDegrees
public DerivativeStructure toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP.- Returns:
- instance converted into degrees
-
toRadians
public DerivativeStructure toRadians()
Convert degrees to radians, with error of less than 0.5 ULP.- Returns:
- instance converted into radians
-
taylor
public double taylor(double... delta)
Evaluate Taylor expansion a derivative structure.- Parameters:
delta- parameters offsets (Δx, Δy, ...)- Returns:
- value of the Taylor expansion at x + Δx, y + Δy, ...
- Throws:
MathArithmeticException- if factorials becomes too large
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure[] a, DerivativeStructure[] b)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- Factors.b- Factors.- Returns:
Σi ai bi.- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
linearCombination
public DerivativeStructure linearCombination(double[] a, DerivativeStructure[] b)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<DerivativeStructure>- Parameters:
a- Factors.b- Factors.- Returns:
Σi ai bi.- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<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:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object),RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<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:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
RealFieldElement.linearCombination(double, Object, double, Object, double, Object),RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<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:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
RealFieldElement.linearCombination(Object, Object, Object, Object),RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<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:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
RealFieldElement.linearCombination(double, Object, double, Object),RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3, DerivativeStructure a4, DerivativeStructure b4)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<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 third termb4- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
RealFieldElement.linearCombination(Object, Object, Object, Object),RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3, double a4, DerivativeStructure b4)
Compute a linear combination.- Specified by:
linearCombinationin interfaceRealFieldElement<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 third termb4- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- Throws:
DimensionMismatchException- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
RealFieldElement.linearCombination(double, Object, double, Object),RealFieldElement.linearCombination(double, Object, double, Object, double, Object)
-
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.
-
-