Class DerivativeStructure
- java.lang.Object
-
- org.hipparchus.analysis.differentiation.DerivativeStructure
-
- All Implemented Interfaces:
Serializable
,Derivative<DerivativeStructure>
,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.
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.
- See Also:
DSCompiler
,FieldDerivativeStructure
, Serialized Form
-
-
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
differentiate(int varIndex, int differentiationOrder)
Differentiate w.r.t. one independent variable.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.DSFactory
getFactory()
Get the factory that built the instance.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.DerivativeStructure
getPi()
Get the Archimedes constant π.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
integrate(int varIndex, int integrationOrder)
Integrate w.r.t. one independent variable.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
newInstance(double value)
Create an instance corresponding to a constant real value.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
rebase(DerivativeStructure... p)
Rebase instance with respect to low level parameter functions.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.DerivativeStructure
scalb(int n)
Multiply the instance by a power of 2.DerivativeStructure
sign()
Compute the sign of the instance.DerivativeStructure
sin()
Sine operation.FieldSinCos<DerivativeStructure>
sinCos()
Combined Sine and Cosine operation.DerivativeStructure
sinh()
Hyperbolic sine operation.FieldSinhCosh<DerivativeStructure>
sinhCosh()
Combined hyperbolic sine and sosine 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 ULPDerivativeStructure
toRadians()
Convert degrees to radians, with error of less than 0.5 ULPDerivativeStructure
ulp()
Compute least significant bit (Unit in Last Position) for a number.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hipparchus.CalculusFieldElement
isFinite, isInfinite, isNaN, norm, round
-
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:
newInstance
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
value
- constant real value- Returns:
- instance corresponding to a constant real value
-
getFactory
public DSFactory getFactory()
Get the factory that built the instance.- Returns:
- factory that built the instance
-
getFreeParameters
public int getFreeParameters()
Description copied from interface:Derivative
Get the number of free parameters.- Specified by:
getFreeParameters
in interfaceDerivative<DerivativeStructure>
- Returns:
- number of free parameters
-
getOrder
public int getOrder()
Description copied from interface:Derivative
Get the derivation order.- Specified by:
getOrder
in interfaceDerivative<DerivativeStructure>
- Returns:
- derivation order
-
getReal
public double getReal()
Get the real value of the number.- Specified by:
getReal
in interfaceFieldElement<DerivativeStructure>
- Returns:
- real value
-
getValue
public double getValue()
Get the value part of the derivative structure.- Specified by:
getValue
in interfaceDerivative<DerivativeStructure>
- Returns:
- value part of the derivative structure
- See Also:
getPartialDerivative(int...)
-
getPartialDerivative
public double getPartialDerivative(int... orders) throws MathIllegalArgumentException
Get a partial derivative.- Specified by:
getPartialDerivative
in 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(double a)
'+' operator.- Specified by:
add
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this+a
-
add
public DerivativeStructure add(DerivativeStructure a) throws MathIllegalArgumentException
Compute this + a.- Specified by:
add
in 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(double a)
'-' operator.- Specified by:
subtract
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this-a
-
subtract
public DerivativeStructure subtract(DerivativeStructure a) throws MathIllegalArgumentException
Compute this - a.- Specified by:
subtract
in 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(int n)
Compute n × this. Multiplication by an integer number is defined as the following sum \[ n \times \mathrm{this} = \sum_{i=1}^n \mathrm{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 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:
multiply
in 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
-
divide
public DerivativeStructure divide(double a)
'÷' operator.- Specified by:
divide
in 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:
divide
in 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(double a)
IEEE remainder operator.- Specified by:
remainder
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this - n × a where n is the closest integer to this/a
-
remainder
public DerivativeStructure remainder(DerivativeStructure a) throws MathIllegalArgumentException
IEEE remainder operator.- Specified by:
remainder
in 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 ofthis
element.- Specified by:
negate
in interfaceFieldElement<DerivativeStructure>
- Returns:
- the opposite of
this
.
-
abs
public DerivativeStructure abs()
absolute value.Just another name for
CalculusFieldElement.norm()
- Specified by:
abs
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- abs(this)
-
ceil
public DerivativeStructure ceil()
Get the smallest whole number larger than instance.- Specified by:
ceil
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- ceil(this)
-
floor
public DerivativeStructure floor()
Get the largest whole number smaller than instance.- Specified by:
floor
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- floor(this)
-
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 interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5
-
sign
public DerivativeStructure sign()
Compute the sign of the instance. The sign is -1 for negative numbers, +1 for positive numbers and 0 otherwise, for Complex number, it is extended on the unit circle (equivalent to z/|z|, with special handling for 0 and NaN)- Specified by:
sign
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
-
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 interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument
-
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 interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument
-
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.
- Specified by:
getExponent
in interfaceCalculusFieldElement<DerivativeStructure>
- 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 interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
n
- power of 2- Returns:
- this × 2n
-
ulp
public DerivativeStructure ulp()
Compute least significant bit (Unit in Last Position) for a number.The
ulp
function is a step function, hence all its derivatives are 0.- Specified by:
ulp
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- ulp(this)
- Since:
- 2.0
-
hypot
public DerivativeStructure hypot(DerivativeStructure y) throws MathIllegalArgumentException
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 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 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:
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:
compose
in 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 ofthis
element.- Specified by:
reciprocal
in interfaceCalculusFieldElement<DerivativeStructure>
- Specified by:
reciprocal
in interfaceFieldElement<DerivativeStructure>
- Returns:
- the inverse of
this
.
-
sqrt
public DerivativeStructure sqrt()
Square root.- Specified by:
sqrt
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- square root of the instance
-
cbrt
public DerivativeStructure cbrt()
Cubic root.- Specified by:
cbrt
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- cubic root of the instance
-
rootN
public DerivativeStructure rootN(int n)
Nth root.- Specified by:
rootN
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
n
- order of the root- Returns:
- nth root of the instance
-
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
-
pow
public DerivativeStructure pow(double p)
Power operation.- Specified by:
pow
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
p
- power to apply- Returns:
- thisp
-
pow
public DerivativeStructure pow(int n)
Integer power operation.- Specified by:
pow
in interfaceCalculusFieldElement<DerivativeStructure>
- Parameters:
n
- power to apply- Returns:
- thisn
-
pow
public DerivativeStructure pow(DerivativeStructure e) throws MathIllegalArgumentException
Power operation.- Specified by:
pow
in interfaceCalculusFieldElement<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:
exp
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- exponential of the instance
-
expm1
public DerivativeStructure expm1()
Exponential minus 1.- Specified by:
expm1
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- exponential minus one of the instance
-
log
public DerivativeStructure log()
Natural logarithm.- Specified by:
log
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- logarithm of the instance
-
log1p
public DerivativeStructure log1p()
Shifted natural logarithm.- Specified by:
log1p
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- logarithm of one plus the instance
-
log10
public DerivativeStructure log10()
Base 10 logarithm.- Specified by:
log10
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- base 10 logarithm of the instance
-
cos
public DerivativeStructure cos()
Cosine operation.- Specified by:
cos
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- cos(this)
-
sin
public DerivativeStructure sin()
Sine operation.- Specified by:
sin
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- sin(this)
-
sinCos
public FieldSinCos<DerivativeStructure> sinCos()
Combined Sine and Cosine operation.- Specified by:
sinCos
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- [sin(this), cos(this)]
-
tan
public DerivativeStructure tan()
Tangent operation.- Specified by:
tan
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- tan(this)
-
acos
public DerivativeStructure acos()
Arc cosine operation.- Specified by:
acos
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- acos(this)
-
asin
public DerivativeStructure asin()
Arc sine operation.- Specified by:
asin
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- asin(this)
-
atan
public DerivativeStructure atan()
Arc tangent operation.- Specified by:
atan
in 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 they
argument and thex
argument 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 languagesatan2
two-arguments arc tangent and putsx
as its first argument.- Specified by:
atan2
in 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:
cosh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- cosh(this)
-
sinh
public DerivativeStructure sinh()
Hyperbolic sine operation.- Specified by:
sinh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- sinh(this)
-
sinhCosh
public FieldSinhCosh<DerivativeStructure> sinhCosh()
Combined hyperbolic sine and sosine operation.- Specified by:
sinhCosh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- [sinh(this), cosh(this)]
-
tanh
public DerivativeStructure tanh()
Hyperbolic tangent operation.- Specified by:
tanh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- tanh(this)
-
acosh
public DerivativeStructure acosh()
Inverse hyperbolic cosine operation.- Specified by:
acosh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- acosh(this)
-
asinh
public DerivativeStructure asinh()
Inverse hyperbolic sine operation.- Specified by:
asinh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- asin(this)
-
atanh
public DerivativeStructure atanh()
Inverse hyperbolic tangent operation.- Specified by:
atanh
in interfaceCalculusFieldElement<DerivativeStructure>
- Returns:
- atanh(this)
-
toDegrees
public DerivativeStructure toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP- Specified by:
toDegrees
in 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:
toRadians
in 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 MathRuntimeException
Evaluate 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 parameters
up to ordero
\(f(p_0, p_1, \ldots p_{n-1})\). Itspartial derivatives
are 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 derivatives
of 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
linearCombination
in 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:
getPi
in 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.
-
-