public class UnivariateDerivative1 extends UnivariateDerivative<UnivariateDerivative1>
This class is a stripped-down version of DerivativeStructure
with only one free parameter
and derivation order
also limited to one.
It should have less overhead than DerivativeStructure
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.
UnivariateDerivative1
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.
Modifier and Type | Field and Description |
---|---|
static UnivariateDerivative1 |
PI
The constant value of π as a
UnivariateDerivative1 . |
Constructor and Description |
---|
UnivariateDerivative1(DerivativeStructure ds)
Build an instance from a
DerivativeStructure . |
UnivariateDerivative1(double f0,
double f1)
Build an instance with values and derivative.
|
Modifier and Type | Method and Description |
---|---|
UnivariateDerivative1 |
abs()
absolute value.
|
UnivariateDerivative1 |
acos()
Arc cosine operation.
|
UnivariateDerivative1 |
acosh()
Inverse hyperbolic cosine operation.
|
UnivariateDerivative1 |
add(double a)
'+' operator.
|
UnivariateDerivative1 |
add(UnivariateDerivative1 a)
Compute this + a.
|
UnivariateDerivative1 |
asin()
Arc sine operation.
|
UnivariateDerivative1 |
asinh()
Inverse hyperbolic sine operation.
|
UnivariateDerivative1 |
atan()
Arc tangent operation.
|
UnivariateDerivative1 |
atan2(UnivariateDerivative1 x)
Two arguments arc tangent operation.
|
UnivariateDerivative1 |
atanh()
Inverse hyperbolic tangent operation.
|
UnivariateDerivative1 |
cbrt()
Cubic root.
|
UnivariateDerivative1 |
ceil()
Get the smallest whole number larger than instance.
|
UnivariateDerivative1 |
compose(double... f)
Compute composition of the instance by a univariate function.
|
UnivariateDerivative1 |
copySign(double sign)
Returns the instance with the sign of the argument.
|
UnivariateDerivative1 |
copySign(UnivariateDerivative1 sign)
Returns the instance with the sign of the argument.
|
UnivariateDerivative1 |
cos()
Cosine operation.
|
UnivariateDerivative1 |
cosh()
Hyperbolic cosine operation.
|
UnivariateDerivative1 |
divide(double a)
'÷' operator.
|
UnivariateDerivative1 |
divide(UnivariateDerivative1 a)
Compute this ÷ a.
|
boolean |
equals(Object other)
Test for the equality of two univariate derivatives.
|
UnivariateDerivative1 |
exp()
Exponential.
|
UnivariateDerivative1 |
expm1()
Exponential minus 1.
|
UnivariateDerivative1 |
floor()
Get the largest whole number smaller than instance.
|
double |
getDerivative(int n)
Get a derivative from the univariate derivative.
|
int |
getExponent()
Return the exponent of the instance, removing the bias.
|
UnivariateDerivative1Field |
getField()
Get the
Field to which the instance belongs. |
double |
getFirstDerivative()
Get the first derivative.
|
int |
getOrder()
Get the derivation order.
|
UnivariateDerivative1 |
getPi()
Get the Archimedes constant π.
|
double |
getReal()
Get the real value of the number.
|
double |
getValue()
Get the value part of the function.
|
int |
hashCode()
Get a hashCode for the univariate derivative.
|
UnivariateDerivative1 |
hypot(UnivariateDerivative1 y)
Returns the hypotenuse of a triangle with sides
this and y
- sqrt(this2 +y2)
avoiding intermediate overflow or underflow. |
UnivariateDerivative1 |
linearCombination(double[] a,
UnivariateDerivative1[] b)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(double a1,
UnivariateDerivative1 b1,
double a2,
UnivariateDerivative1 b2)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(double a1,
UnivariateDerivative1 b1,
double a2,
UnivariateDerivative1 b2,
double a3,
UnivariateDerivative1 b3)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(double a1,
UnivariateDerivative1 b1,
double a2,
UnivariateDerivative1 b2,
double a3,
UnivariateDerivative1 b3,
double a4,
UnivariateDerivative1 b4)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(UnivariateDerivative1[] a,
UnivariateDerivative1[] b)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(UnivariateDerivative1 a1,
UnivariateDerivative1 b1,
UnivariateDerivative1 a2,
UnivariateDerivative1 b2)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(UnivariateDerivative1 a1,
UnivariateDerivative1 b1,
UnivariateDerivative1 a2,
UnivariateDerivative1 b2,
UnivariateDerivative1 a3,
UnivariateDerivative1 b3)
Compute a linear combination.
|
UnivariateDerivative1 |
linearCombination(UnivariateDerivative1 a1,
UnivariateDerivative1 b1,
UnivariateDerivative1 a2,
UnivariateDerivative1 b2,
UnivariateDerivative1 a3,
UnivariateDerivative1 b3,
UnivariateDerivative1 a4,
UnivariateDerivative1 b4)
Compute a linear combination.
|
UnivariateDerivative1 |
log()
Natural logarithm.
|
UnivariateDerivative1 |
log10()
Base 10 logarithm.
|
UnivariateDerivative1 |
log1p()
Shifted natural logarithm.
|
UnivariateDerivative1 |
multiply(double a)
'×' operator.
|
UnivariateDerivative1 |
multiply(int n)
Compute n × this.
|
UnivariateDerivative1 |
multiply(UnivariateDerivative1 a)
Compute this × a.
|
UnivariateDerivative1 |
negate()
Returns the additive inverse of
this element. |
UnivariateDerivative1 |
newInstance(double value)
Create an instance corresponding to a constant real value.
|
UnivariateDerivative1 |
pow(double p)
Power operation.
|
static UnivariateDerivative1 |
pow(double a,
UnivariateDerivative1 x)
Compute ax where a is a double and x a
UnivariateDerivative1 |
UnivariateDerivative1 |
pow(int n)
Integer power operation.
|
UnivariateDerivative1 |
pow(UnivariateDerivative1 e)
Power operation.
|
UnivariateDerivative1 |
reciprocal()
Returns the multiplicative inverse of
this element. |
UnivariateDerivative1 |
remainder(double a)
IEEE remainder operator.
|
UnivariateDerivative1 |
remainder(UnivariateDerivative1 a)
IEEE remainder operator.
|
UnivariateDerivative1 |
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.
|
UnivariateDerivative1 |
rootN(int n)
Nth root.
|
UnivariateDerivative1 |
scalb(int n)
Multiply the instance by a power of 2.
|
UnivariateDerivative1 |
sign()
Compute the sign of the instance.
|
UnivariateDerivative1 |
sin()
Sine operation.
|
FieldSinCos<UnivariateDerivative1> |
sinCos()
Combined Sine and Cosine operation.
|
UnivariateDerivative1 |
sinh()
Hyperbolic sine operation.
|
FieldSinhCosh<UnivariateDerivative1> |
sinhCosh()
Combined hyperbolic sine and sosine operation.
|
UnivariateDerivative1 |
sqrt()
Square root.
|
UnivariateDerivative1 |
subtract(double a)
'-' operator.
|
UnivariateDerivative1 |
subtract(UnivariateDerivative1 a)
Compute this - a.
|
UnivariateDerivative1 |
tan()
Tangent operation.
|
UnivariateDerivative1 |
tanh()
Hyperbolic tangent operation.
|
double |
taylor(double delta)
Evaluate Taylor expansion a univariate derivative.
|
UnivariateDerivative1 |
toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP
|
DerivativeStructure |
toDerivativeStructure()
Convert the instance to a
DerivativeStructure . |
UnivariateDerivative1 |
toRadians()
Convert degrees to radians, with error of less than 0.5 ULP
|
UnivariateDerivative1 |
ulp()
Compute least significant bit (Unit in Last Position) for a number.
|
getFreeParameters, getPartialDerivative
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isFinite, isInfinite, isNaN, norm, round
isZero
public static final UnivariateDerivative1 PI
UnivariateDerivative1
.public UnivariateDerivative1(double f0, double f1)
f0
- value of the functionf1
- first derivative of the functionpublic UnivariateDerivative1(DerivativeStructure ds) throws MathIllegalArgumentException
DerivativeStructure
.ds
- derivative structureMathIllegalArgumentException
- if either ds
parameters
is not 1 or ds
order is not 1public UnivariateDerivative1 newInstance(double value)
value
- constant real valuepublic double getReal()
public double getValue()
public double getDerivative(int n)
getDerivative
in class UnivariateDerivative<UnivariateDerivative1>
n
- derivation order (must be between 0 and Derivative.getOrder()
, both inclusive)public int getOrder()
public double getFirstDerivative()
getValue()
public DerivativeStructure toDerivativeStructure()
DerivativeStructure
.toDerivativeStructure
in class UnivariateDerivative<UnivariateDerivative1>
public UnivariateDerivative1 add(double a)
a
- right hand side parameter of the operatorpublic UnivariateDerivative1 add(UnivariateDerivative1 a)
a
- element to addpublic UnivariateDerivative1 subtract(double a)
a
- right hand side parameter of the operatorpublic UnivariateDerivative1 subtract(UnivariateDerivative1 a)
a
- element to subtractpublic UnivariateDerivative1 multiply(int n)
n
- Number of times this
must be added to itself.public UnivariateDerivative1 multiply(double a)
a
- right hand side parameter of the operatorpublic UnivariateDerivative1 multiply(UnivariateDerivative1 a)
a
- element to multiplypublic UnivariateDerivative1 divide(double a)
a
- right hand side parameter of the operatorpublic UnivariateDerivative1 divide(UnivariateDerivative1 a)
a
- element to divide bypublic UnivariateDerivative1 remainder(double a)
a
- right hand side parameter of the operatorpublic UnivariateDerivative1 remainder(UnivariateDerivative1 a)
a
- right hand side parameter of the operatorpublic UnivariateDerivative1 negate()
this
element.this
.public UnivariateDerivative1 abs()
Just another name for CalculusFieldElement.norm()
public UnivariateDerivative1 ceil()
public UnivariateDerivative1 floor()
public UnivariateDerivative1 rint()
public UnivariateDerivative1 sign()
public UnivariateDerivative1 copySign(UnivariateDerivative1 sign)
sign
argument is treated as positive.sign
- the sign for the returned valuesign
argumentpublic UnivariateDerivative1 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 UnivariateDerivative1 scalb(int n)
n
- power of 2public UnivariateDerivative1 ulp()
The ulp
function is a step function, hence all its derivatives are 0.
public UnivariateDerivative1 hypot(UnivariateDerivative1 y)
this
and y
- sqrt(this2 +y2)
avoiding intermediate overflow or underflow.
y
- a valuepublic UnivariateDerivative1 reciprocal()
this
element.this
.public UnivariateDerivative1 compose(double... f)
f
- array of value and derivatives of the function at
the current point (i.e. [f(Derivative.getValue()
),
f'(Derivative.getValue()
), f''(Derivative.getValue()
)...]).public UnivariateDerivative1 sqrt()
public UnivariateDerivative1 cbrt()
public UnivariateDerivative1 rootN(int n)
n
- order of the rootpublic UnivariateDerivative1Field getField()
Field
to which the instance belongs.Field
to which the instance belongspublic static UnivariateDerivative1 pow(double a, UnivariateDerivative1 x)
UnivariateDerivative1
a
- number to exponentiatex
- power to applypublic UnivariateDerivative1 pow(double p)
p
- power to applypublic UnivariateDerivative1 pow(int n)
n
- power to applypublic UnivariateDerivative1 pow(UnivariateDerivative1 e)
e
- exponentpublic UnivariateDerivative1 exp()
public UnivariateDerivative1 expm1()
public UnivariateDerivative1 log()
public UnivariateDerivative1 log1p()
public UnivariateDerivative1 log10()
public UnivariateDerivative1 cos()
public UnivariateDerivative1 sin()
public FieldSinCos<UnivariateDerivative1> sinCos()
public UnivariateDerivative1 tan()
public UnivariateDerivative1 acos()
public UnivariateDerivative1 asin()
public UnivariateDerivative1 atan()
public UnivariateDerivative1 atan2(UnivariateDerivative1 x)
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 computes atan2(this, x)
, i.e. the instance
represents the y
argument and the x
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 languages atan2
two-arguments arc tangent
and puts x
as its first argument.
x
- second argument of the arc tangentpublic UnivariateDerivative1 cosh()
public UnivariateDerivative1 sinh()
public FieldSinhCosh<UnivariateDerivative1> sinhCosh()
public UnivariateDerivative1 tanh()
public UnivariateDerivative1 acosh()
public UnivariateDerivative1 asinh()
public UnivariateDerivative1 atanh()
public UnivariateDerivative1 toDegrees()
public UnivariateDerivative1 toRadians()
public double taylor(double delta)
delta
- parameter offset Δxpublic UnivariateDerivative1 linearCombination(UnivariateDerivative1[] a, UnivariateDerivative1[] b)
a
- Factors.b
- Factors.Σi ai bi
.public UnivariateDerivative1 linearCombination(double[] a, UnivariateDerivative1[] b)
a
- Factors.b
- Factors.Σi ai bi
.public UnivariateDerivative1 linearCombination(UnivariateDerivative1 a1, UnivariateDerivative1 b1, UnivariateDerivative1 a2, UnivariateDerivative1 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(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
,
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
public UnivariateDerivative1 linearCombination(double a1, UnivariateDerivative1 b1, double a2, UnivariateDerivative1 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, FieldElement, double, FieldElement, double, FieldElement)
,
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement, double, FieldElement)
public UnivariateDerivative1 linearCombination(UnivariateDerivative1 a1, UnivariateDerivative1 b1, UnivariateDerivative1 a2, UnivariateDerivative1 b2, UnivariateDerivative1 a3, UnivariateDerivative1 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(FieldElement, FieldElement, FieldElement, FieldElement)
,
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
public UnivariateDerivative1 linearCombination(double a1, UnivariateDerivative1 b1, double a2, UnivariateDerivative1 b2, double a3, UnivariateDerivative1 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, FieldElement, double, FieldElement)
,
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement, double, FieldElement)
public UnivariateDerivative1 linearCombination(UnivariateDerivative1 a1, UnivariateDerivative1 b1, UnivariateDerivative1 a2, UnivariateDerivative1 b2, UnivariateDerivative1 a3, UnivariateDerivative1 b3, UnivariateDerivative1 a4, UnivariateDerivative1 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(FieldElement, FieldElement, FieldElement, FieldElement)
,
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
public UnivariateDerivative1 linearCombination(double a1, UnivariateDerivative1 b1, double a2, UnivariateDerivative1 b2, double a3, UnivariateDerivative1 b3, double a4, UnivariateDerivative1 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, FieldElement, double, FieldElement)
,
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement)
public UnivariateDerivative1 getPi()
Archimedes constant is the ratio of a circle's circumference to its diameter.
public boolean equals(Object other)
univariate derivatives are considered equal if they have the same derivatives.
Copyright © 2016-2021 CS GROUP. All rights reserved.