T
- the type of the function parameters and valuepublic class FieldUnivariateDerivative2<T extends RealFieldElement<T>> extends FieldUnivariateDerivative<T,FieldUnivariateDerivative2<T>>
This class is a stripped-down version of FieldDerivativeStructure
with only one free parameter
and derivation order
limited to two.
It should have less overhead than FieldDerivativeStructure
in its domain.
This class is an implementation of Rall's numbers. 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.
FieldUnivariateDerivative2
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.
Instances of this class are guaranteed to be immutable.
DerivativeStructure
,
UnivariateDerivative1
,
UnivariateDerivative2
,
Gradient
,
FieldDerivativeStructure
,
FieldUnivariateDerivative1
,
FieldGradient
DEG_TO_RAD, RAD_TO_DEG
Constructor and Description |
---|
FieldUnivariateDerivative2(FieldDerivativeStructure<T> ds)
Build an instance from a
DerivativeStructure . |
FieldUnivariateDerivative2(T f0,
T f1,
T f2)
Build an instance with values and derivative.
|
getFreeParameters, getPartialDerivative
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
round
isInfinite, isNaN
isZero
public FieldUnivariateDerivative2(T f0, T f1, T f2)
f0
- value of the functionf1
- first derivative of the functionf2
- second derivative of the functionpublic FieldUnivariateDerivative2(FieldDerivativeStructure<T> ds) throws MathIllegalArgumentException
DerivativeStructure
.ds
- derivative structureMathIllegalArgumentException
- if either ds
parameters
is not 1 or ds
order is not 2public FieldUnivariateDerivative2<T> newInstance(double value)
The default implementation creates the instance by adding
the value to getField().getZero()
. This is not optimal
and does not work when called with a negative zero as the
sign of zero is lost with the addition. The default implementation
should therefore be overridden in concrete classes. The default
implementation will be removed at the next major version.
value
- constant real valuepublic double getReal()
public T getValue()
public T getDerivative(int n)
getDerivative
in class FieldUnivariateDerivative<T extends RealFieldElement<T>,FieldUnivariateDerivative2<T extends RealFieldElement<T>>>
n
- derivation order (must be between 0 and getOrder()
, both inclusive)NaN
if n is
either negative or strictly larger than getOrder()
public int getOrder()
public T getFirstDerivative()
getValue()
public T getSecondDerivative()
getValue()
,
getFirstDerivative()
public Field<T> getValueField()
Field
the value and parameters of the function belongs to.Field
the value and parameters of the function belongs topublic FieldDerivativeStructure<T> toDerivativeStructure()
FieldDerivativeStructure
.toDerivativeStructure
in class FieldUnivariateDerivative<T extends RealFieldElement<T>,FieldUnivariateDerivative2<T extends RealFieldElement<T>>>
public FieldUnivariateDerivative2<T> add(T a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> add(double a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> add(FieldUnivariateDerivative2<T> a)
a
- element to addpublic FieldUnivariateDerivative2<T> subtract(T a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> subtract(double a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> subtract(FieldUnivariateDerivative2<T> a)
a
- element to subtractpublic FieldUnivariateDerivative2<T> multiply(T a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> multiply(int n)
n
- Number of times this
must be added to itself.public FieldUnivariateDerivative2<T> multiply(double a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> multiply(FieldUnivariateDerivative2<T> a)
a
- element to multiplypublic FieldUnivariateDerivative2<T> divide(T a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> divide(double a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> divide(FieldUnivariateDerivative2<T> a)
a
- element to divide bypublic FieldUnivariateDerivative2<T> remainder(T a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> remainder(double a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> remainder(FieldUnivariateDerivative2<T> a)
a
- right hand side parameter of the operatorpublic FieldUnivariateDerivative2<T> negate()
this
element.this
.public FieldUnivariateDerivative2<T> abs()
public FieldUnivariateDerivative2<T> ceil()
public FieldUnivariateDerivative2<T> floor()
public FieldUnivariateDerivative2<T> rint()
public FieldUnivariateDerivative2<T> signum()
public FieldUnivariateDerivative2<T> copySign(T sign)
sign
argument is treated as positive.sign
- the sign for the returned valuesign
argumentpublic FieldUnivariateDerivative2<T> copySign(FieldUnivariateDerivative2<T> sign)
sign
argument is treated as positive.sign
- the sign for the returned valuesign
argumentpublic FieldUnivariateDerivative2<T> copySign(double sign)
sign
argument is treated as positive.sign
- the sign for the returned valuesign
argumentpublic int getExponent()
For double numbers of the form 2x, the unbiased exponent is exactly x.
public FieldUnivariateDerivative2<T> scalb(int n)
n
- power of 2public FieldUnivariateDerivative2<T> hypot(FieldUnivariateDerivative2<T> y)
this
and y
- sqrt(this2 +y2)
avoiding intermediate overflow or underflow.
y
- a valuepublic FieldUnivariateDerivative2<T> reciprocal()
this
element.this
.public FieldUnivariateDerivative2<T> compose(T g0, T g1, T g2)
g0
- value of the function at the current point (i.e. at g(getValue())
)g1
- first derivative of the function at the current point (i.e. at g'(getValue())
)g2
- second derivative of the function at the current point (i.e. at g''(getValue())
)public FieldUnivariateDerivative2<T> sqrt()
public FieldUnivariateDerivative2<T> cbrt()
public FieldUnivariateDerivative2<T> rootN(int n)
n
- order of the rootpublic FieldUnivariateDerivative2Field<T> getField()
Field
to which the instance belongs.Field
to which the instance belongspublic static <T extends RealFieldElement<T>> FieldUnivariateDerivative2<T> pow(double a, FieldUnivariateDerivative2<T> x)
FieldUnivariateDerivative2
T
- the type of the function parameters and valuea
- number to exponentiatex
- power to applypublic FieldUnivariateDerivative2<T> pow(double p)
p
- power to applypublic FieldUnivariateDerivative2<T> pow(int n)
n
- power to applypublic FieldUnivariateDerivative2<T> pow(FieldUnivariateDerivative2<T> e)
e
- exponentpublic FieldUnivariateDerivative2<T> exp()
public FieldUnivariateDerivative2<T> expm1()
public FieldUnivariateDerivative2<T> log()
public FieldUnivariateDerivative2<T> log1p()
public FieldUnivariateDerivative2<T> log10()
public FieldUnivariateDerivative2<T> cos()
public FieldUnivariateDerivative2<T> sin()
public FieldSinCos<FieldUnivariateDerivative2<T>> sinCos()
public FieldUnivariateDerivative2<T> tan()
public FieldUnivariateDerivative2<T> acos()
public FieldUnivariateDerivative2<T> asin()
public FieldUnivariateDerivative2<T> atan()
public FieldUnivariateDerivative2<T> atan2(FieldUnivariateDerivative2<T> x)
x
- second argument of the arc tangentpublic FieldUnivariateDerivative2<T> cosh()
public FieldUnivariateDerivative2<T> sinh()
public FieldUnivariateDerivative2<T> tanh()
public FieldUnivariateDerivative2<T> acosh()
public FieldUnivariateDerivative2<T> asinh()
public FieldUnivariateDerivative2<T> atanh()
public FieldUnivariateDerivative2<T> toDegrees()
public FieldUnivariateDerivative2<T> toRadians()
public T taylor(double delta)
delta
- parameter offset Δxpublic T taylor(T delta)
delta
- parameter offset Δxpublic FieldUnivariateDerivative2<T> linearCombination(T[] a, FieldUnivariateDerivative2<T>[] b)
a
- Factors.b
- Factors.Σi ai bi
.MathIllegalArgumentException
- if arrays dimensions don't matchpublic FieldUnivariateDerivative2<T> linearCombination(FieldUnivariateDerivative2<T>[] a, FieldUnivariateDerivative2<T>[] b)
a
- Factors.b
- Factors.Σi ai bi
.public FieldUnivariateDerivative2<T> linearCombination(double[] a, FieldUnivariateDerivative2<T>[] b)
a
- Factors.b
- Factors.Σi ai bi
.public FieldUnivariateDerivative2<T> linearCombination(FieldUnivariateDerivative2<T> a1, FieldUnivariateDerivative2<T> b1, FieldUnivariateDerivative2<T> a2, FieldUnivariateDerivative2<T> b2)
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second termCalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
,
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
public FieldUnivariateDerivative2<T> linearCombination(double a1, FieldUnivariateDerivative2<T> b1, double a2, FieldUnivariateDerivative2<T> b2)
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second termCalculusFieldElement.linearCombination(double, Object, double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
public FieldUnivariateDerivative2<T> linearCombination(FieldUnivariateDerivative2<T> a1, FieldUnivariateDerivative2<T> b1, FieldUnivariateDerivative2<T> a2, FieldUnivariateDerivative2<T> b2, FieldUnivariateDerivative2<T> a3, FieldUnivariateDerivative2<T> b3)
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 termCalculusFieldElement.linearCombination(Object, Object, Object, Object)
,
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
public FieldUnivariateDerivative2<T> linearCombination(T a1, FieldUnivariateDerivative2<T> b1, T a2, FieldUnivariateDerivative2<T> b2, T a3, FieldUnivariateDerivative2<T> b3)
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 termMathIllegalArgumentException
- if number of free parameters or orders are inconsistentCalculusFieldElement.linearCombination(double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
public FieldUnivariateDerivative2<T> linearCombination(double a1, FieldUnivariateDerivative2<T> b1, double a2, FieldUnivariateDerivative2<T> b2, double a3, FieldUnivariateDerivative2<T> b3)
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 termCalculusFieldElement.linearCombination(double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
public FieldUnivariateDerivative2<T> linearCombination(FieldUnivariateDerivative2<T> a1, FieldUnivariateDerivative2<T> b1, FieldUnivariateDerivative2<T> a2, FieldUnivariateDerivative2<T> b2, FieldUnivariateDerivative2<T> a3, FieldUnivariateDerivative2<T> b3, FieldUnivariateDerivative2<T> a4, FieldUnivariateDerivative2<T> b4)
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 termCalculusFieldElement.linearCombination(Object, Object, Object, Object)
,
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
public FieldUnivariateDerivative2<T> linearCombination(double a1, FieldUnivariateDerivative2<T> b1, double a2, FieldUnivariateDerivative2<T> b2, double a3, FieldUnivariateDerivative2<T> b3, double a4, FieldUnivariateDerivative2<T> b4)
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 termCalculusFieldElement.linearCombination(double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object)
public boolean equals(Object other)
univariate derivatives are considered equal if they have the same derivatives.
Copyright © 2016–2020 Hipparchus.org. All rights reserved.