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.
DerivativeStructure
instances 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
differentiators
to 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 DerivativeStructure
abs()
absolute value.DerivativeStructure
acos()
Arc cosine operation.DerivativeStructure
acosh()
Inverse hyperbolic cosine operation.DerivativeStructure
add(double a)
'+' operator.DerivativeStructure
add(DerivativeStructure a)
Compute this + a.DerivativeStructure
asin()
Arc sine operation.DerivativeStructure
asinh()
Inverse hyperbolic sine operation.DerivativeStructure
atan()
Arc tangent operation.DerivativeStructure
atan2(DerivativeStructure x)
Two arguments arc tangent operation.static DerivativeStructure
atan2(DerivativeStructure y, DerivativeStructure x)
Two arguments arc tangent operation.DerivativeStructure
atanh()
Inverse hyperbolic tangent operation.DerivativeStructure
cbrt()
Cubic root.DerivativeStructure
ceil()
Get the smallest whole number larger than instance.DerivativeStructure
compose(double... f)
Compute composition of the instance by a univariate function.DerivativeStructure
copySign(double sign)
Returns the instance with the sign of the argument.DerivativeStructure
copySign(DerivativeStructure sign)
Returns the instance with the sign of the argument.DerivativeStructure
cos()
Cosine operation.DerivativeStructure
cosh()
Hyperbolic cosine operation.DerivativeStructure
createConstant(double c)
Create a constant compatible with instance order and number of parameters.DerivativeStructure
divide(double a)
'÷' operator.DerivativeStructure
divide(DerivativeStructure a)
Compute this ÷ a.boolean
equals(Object other)
Test for the equality of two derivative structures.DerivativeStructure
exp()
Exponential.DerivativeStructure
expm1()
Exponential minus 1.DerivativeStructure
floor()
Get the largest whole number smaller than instance.double[]
getAllDerivatives()
Get all partial derivatives.int
getExponent()
Return the exponent of the instance value, removing the bias.Field<DerivativeStructure>
getField()
Get theField
to which the instance belongs.int
getFreeParameters()
Get the number of free parameters.int
getOrder()
Get the derivation order.double
getPartialDerivative(int... orders)
Get a partial derivative.double
getReal()
Get the real value of the number.double
getValue()
Get the value part of the derivative structure.int
hashCode()
Get a hashCode for the derivative structure.DerivativeStructure
hypot(DerivativeStructure y)
Returns the hypotenuse of a triangle with sidesthis
andy
- sqrt(this2 +y2) avoiding intermediate overflow or underflow.static DerivativeStructure
hypot(DerivativeStructure x, DerivativeStructure y)
Returns the hypotenuse of a triangle with sidesx
andy
- sqrt(x2 +y2) avoiding intermediate overflow or underflow.DerivativeStructure
linearCombination(double[] a, DerivativeStructure[] b)
Compute a linear combination.DerivativeStructure
linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2)
Compute a linear combination.DerivativeStructure
linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3)
Compute a linear combination.DerivativeStructure
linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3, double a4, DerivativeStructure b4)
Compute a linear combination.DerivativeStructure
linearCombination(DerivativeStructure[] a, DerivativeStructure[] b)
Compute a linear combination.DerivativeStructure
linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2)
Compute a linear combination.DerivativeStructure
linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3)
Compute a linear combination.DerivativeStructure
linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3, DerivativeStructure a4, DerivativeStructure b4)
Compute a linear combination.DerivativeStructure
log()
Natural logarithm.DerivativeStructure
log10()
Base 10 logarithm.DerivativeStructure
log1p()
Shifted natural logarithm.DerivativeStructure
multiply(double a)
'×' operator.DerivativeStructure
multiply(int n)
Compute n × this.DerivativeStructure
multiply(DerivativeStructure a)
Compute this × a.DerivativeStructure
negate()
Returns the additive inverse ofthis
element.DerivativeStructure
pow(double p)
Power operation.static DerivativeStructure
pow(double a, DerivativeStructure x)
Compute ax where a is a double and x aDerivativeStructure
.DerivativeStructure
pow(int n)
Integer power operation.DerivativeStructure
pow(DerivativeStructure e)
Power operation.DerivativeStructure
reciprocal()
Returns the multiplicative inverse ofthis
element.DerivativeStructure
remainder(double a)
IEEE remainder operator.DerivativeStructure
remainder(DerivativeStructure a)
IEEE remainder operator.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.DerivativeStructure
rootN(int n)
Nth root.long
round()
Get the closest long to instance value.DerivativeStructure
scalb(int n)
Multiply the instance by a power of 2.DerivativeStructure
signum()
Compute the signum of the instance.DerivativeStructure
sin()
Sine operation.DerivativeStructure
sinh()
Hyperbolic sine operation.DerivativeStructure
sqrt()
Square root.DerivativeStructure
subtract(double a)
'-' operator.DerivativeStructure
subtract(DerivativeStructure a)
Compute this - a.DerivativeStructure
tan()
Tangent operation.DerivativeStructure
tanh()
Hyperbolic tangent operation.double
taylor(double... delta)
Evaluate Taylor expansion a derivative structure.DerivativeStructure
toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP.DerivativeStructure
toRadians()
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 thesize
expected 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:
getReal
in 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:
add
in 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:
add
in 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:
subtract
in 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:
subtract
in 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:
multiply
in interfaceFieldElement<DerivativeStructure>
- Parameters:
n
- Number of timesthis
must be added to itself.- Returns:
- A new element representing n × this.
-
multiply
public DerivativeStructure multiply(double a)
'×' operator.- Specified by:
multiply
in 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:
multiply
in 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:
divide
in 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:
divide
in 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:
remainder
in 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:
remainder
in 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 ofthis
element.- Specified by:
negate
in interfaceFieldElement<DerivativeStructure>
- Returns:
- the opposite of
this
.
-
abs
public DerivativeStructure abs()
absolute value.- Specified by:
abs
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- abs(this)
- Since:
- 3.2
-
ceil
public DerivativeStructure ceil()
Get the smallest whole number larger than instance.- Specified by:
ceil
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- ceil(this)
- Since:
- 3.2
-
floor
public DerivativeStructure floor()
Get the largest whole number smaller than instance.- Specified by:
floor
in 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:
rint
in 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:
round
in 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:
signum
in 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 NaNsign
argument is treated as positive.- Specified by:
copySign
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument - Since:
- 3.2
-
copySign
public DerivativeStructure copySign(double sign)
Returns the instance with the sign of the argument. A NaNsign
argument is treated as positive.- Specified by:
copySign
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument - 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:
scalb
in 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 sidesthis
andy
- 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:
hypot
in 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 sidesx
andy
- 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 ofthis
element.- Specified by:
reciprocal
in interfaceFieldElement<DerivativeStructure>
- Specified by:
reciprocal
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- the inverse of
this
.
-
sqrt
public DerivativeStructure sqrt()
Square root.- Specified by:
sqrt
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- square root of the instance
- Since:
- 3.2
-
cbrt
public DerivativeStructure cbrt()
Cubic root.- Specified by:
cbrt
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- cubic root of the instance
- Since:
- 3.2
-
rootN
public DerivativeStructure rootN(int n)
Nth root.- Specified by:
rootN
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
n
- order of the root- Returns:
- nth root of the instance
- Since:
- 3.2
-
getField
public Field<DerivativeStructure> getField()
Get theField
to which the instance belongs.- Specified by:
getField
in interfaceFieldElement<DerivativeStructure>
- Returns:
Field
to 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:
pow
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
p
- power to apply- Returns:
- thisp
- Since:
- 3.2
-
pow
public DerivativeStructure pow(int n)
Integer power operation.- Specified by:
pow
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
n
- power to apply- Returns:
- thisn
- Since:
- 3.2
-
pow
public DerivativeStructure pow(DerivativeStructure e)
Power operation.- Specified by:
pow
in 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:
exp
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- exponential of the instance
- Since:
- 3.2
-
expm1
public DerivativeStructure expm1()
Exponential minus 1.- Specified by:
expm1
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- exponential minus one of the instance
- Since:
- 3.2
-
log
public DerivativeStructure log()
Natural logarithm.- Specified by:
log
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- logarithm of the instance
- Since:
- 3.2
-
log1p
public DerivativeStructure log1p()
Shifted natural logarithm.- Specified by:
log1p
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- logarithm of one plus the instance
- Since:
- 3.2
-
log10
public DerivativeStructure log10()
Base 10 logarithm.- Specified by:
log10
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- base 10 logarithm of the instance
-
cos
public DerivativeStructure cos()
Cosine operation.- Specified by:
cos
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- cos(this)
- Since:
- 3.2
-
sin
public DerivativeStructure sin()
Sine operation.- Specified by:
sin
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- sin(this)
- Since:
- 3.2
-
tan
public DerivativeStructure tan()
Tangent operation.- Specified by:
tan
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- tan(this)
- Since:
- 3.2
-
acos
public DerivativeStructure acos()
Arc cosine operation.- Specified by:
acos
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- acos(this)
- Since:
- 3.2
-
asin
public DerivativeStructure asin()
Arc sine operation.- Specified by:
asin
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- asin(this)
- Since:
- 3.2
-
atan
public DerivativeStructure atan()
Arc tangent operation.- Specified by:
atan
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- atan(this)
- Since:
- 3.2
-
atan2
public DerivativeStructure atan2(DerivativeStructure x)
Two arguments arc tangent operation.- Specified by:
atan2
in 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:
cosh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- cosh(this)
- Since:
- 3.2
-
sinh
public DerivativeStructure sinh()
Hyperbolic sine operation.- Specified by:
sinh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- sinh(this)
- Since:
- 3.2
-
tanh
public DerivativeStructure tanh()
Hyperbolic tangent operation.- Specified by:
tanh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- tanh(this)
- Since:
- 3.2
-
acosh
public DerivativeStructure acosh()
Inverse hyperbolic cosine operation.- Specified by:
acosh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- acosh(this)
- Since:
- 3.2
-
asinh
public DerivativeStructure asinh()
Inverse hyperbolic sine operation.- Specified by:
asinh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- asin(this)
- Since:
- 3.2
-
atanh
public DerivativeStructure atanh()
Inverse hyperbolic tangent operation.- Specified by:
atanh
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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.
-
-