org.apache.commons.math3.analysis.differentiation
Class DerivativeStructure

java.lang.Object
  extended by org.apache.commons.math3.analysis.differentiation.DerivativeStructure
All Implemented Interfaces:
Serializable, FieldElement<DerivativeStructure>, RealFieldElement<DerivativeStructure>

public class DerivativeStructure
extends Object
implements RealFieldElement<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 static 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 no 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 the DerivativeStructure-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 for finite differences differentiator.

Instances of this class are guaranteed to be immutable.

Since:
3.1
Version:
$Id: DerivativeStructure.java 1462423 2013-03-29 07:25:18Z luc $
See Also:
DSCompiler, Serialized Form

Constructor Summary
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... derivatives)
          Build an instance from all its derivatives.
DerivativeStructure(int parameters, int order, double value)
          Build an instance representing a constant value.
DerivativeStructure(int parameters, int order, int index, double value)
          Build an instance representing a variable.
 
Method Summary
 DerivativeStructure abs()
          absolute value.
 DerivativeStructure acos()
          Arc cosine operation.
 DerivativeStructure acosh()
          Inverse hyperbolic cosine operation.
 DerivativeStructure add(DerivativeStructure a)
          Compute this + a.
 DerivativeStructure add(double a)
          '+' operator.
 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(DerivativeStructure sign)
          Returns the instance with the sign of the argument.
 DerivativeStructure copySign(double sign)
          Returns the instance with the sign of the argument.
 DerivativeStructure cos()
          Cosine operation.
 DerivativeStructure cosh()
          Hyperbolic cosine operation.
 DerivativeStructure divide(DerivativeStructure a)
          Compute this ÷ a.
 DerivativeStructure divide(double a)
          '÷s;' operator.
 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 the Field 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 sides this and y - sqrt(this2 +y2)
avoiding intermediate overflow or underflow.
static DerivativeStructure hypot(DerivativeStructure x, DerivativeStructure y)
          Returns the hypotenuse of a triangle with sides x and y - sqrt(x2 +y2)
avoiding intermediate overflow or underflow.
 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 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 log()
          Natural logarithm.
 DerivativeStructure log10()
          Base 10 logarithm.
 DerivativeStructure log1p()
          Shifted natural logarithm.
 DerivativeStructure multiply(DerivativeStructure a)
          Compute this × a.
 DerivativeStructure multiply(double a)
          '×' operator.
 DerivativeStructure multiply(int n)
          Compute n × this.
 DerivativeStructure negate()
          Returns the additive inverse of this element.
 DerivativeStructure pow(DerivativeStructure e)
          Power operation.
 DerivativeStructure pow(double p)
          Power operation.
 DerivativeStructure pow(int n)
          Integer power operation.
 DerivativeStructure reciprocal()
          Returns the multiplicative inverse of this element.
 DerivativeStructure remainder(DerivativeStructure a)
          IEEE remainder operator.
 DerivativeStructure remainder(double 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(DerivativeStructure a)
          Compute this - a.
 DerivativeStructure subtract(double a)
          '-' operator.
 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerivativeStructure

public DerivativeStructure(int parameters,
                           int order)
                    throws NumberIsTooLargeException
Build an instance with all values and derivatives set to 0.

Parameters:
parameters - number of free parameters
order - derivation order
Throws:
NumberIsTooLargeException - if order is too large

DerivativeStructure

public DerivativeStructure(int parameters,
                           int order,
                           double value)
                    throws NumberIsTooLargeException
Build an instance representing a constant value.

Parameters:
parameters - number of free parameters
order - derivation order
value - 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)
                    throws NumberIsTooLargeException
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 parameters
order - derivation order
index - index of the variable (from 0 to parameters - 1)
value - value of the variable
Throws:
NumberIsTooLargeException - if index >= parameters.
See Also:
DerivativeStructure(int, int, double)

DerivativeStructure

public DerivativeStructure(double a1,
                           DerivativeStructure ds1,
                           double a2,
                           DerivativeStructure ds2)
                    throws DimensionMismatchException
Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2

Parameters:
a1 - first scale factor
ds1 - first base (unscaled) derivative structure
a2 - second scale factor
ds2 - 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)
                    throws DimensionMismatchException
Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3

Parameters:
a1 - first scale factor
ds1 - first base (unscaled) derivative structure
a2 - second scale factor
ds2 - second base (unscaled) derivative structure
a3 - third scale factor
ds3 - 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)
                    throws DimensionMismatchException
Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4

Parameters:
a1 - first scale factor
ds1 - first base (unscaled) derivative structure
a2 - second scale factor
ds2 - second base (unscaled) derivative structure
a3 - third scale factor
ds3 - third base (unscaled) derivative structure
a4 - fourth scale factor
ds4 - 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)
                    throws DimensionMismatchException,
                           NumberIsTooLargeException
Build an instance from all its derivatives.

Parameters:
parameters - number of free parameters
order - derivation order
derivatives - derivatives sorted according to DSCompiler.getPartialDerivativeIndex(int...)
Throws:
DimensionMismatchException - if derivatives array does not match the size 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

getReal

public double getReal()
Get the real value of the number.

Specified by:
getReal in interface RealFieldElement<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)
                            throws DimensionMismatchException,
                                   NumberIsTooLargeException
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 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 interface RealFieldElement<DerivativeStructure>
Parameters:
a - right hand side parameter of the operator
Returns:
this+a
Since:
3.2

add

public DerivativeStructure add(DerivativeStructure a)
                        throws DimensionMismatchException
Compute this + a.

Specified by:
add in interface FieldElement<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 interface RealFieldElement<DerivativeStructure>
Parameters:
a - right hand side parameter of the operator
Returns:
this-a
Since:
3.2

subtract

public DerivativeStructure subtract(DerivativeStructure a)
                             throws DimensionMismatchException
Compute this - a.

Specified by:
subtract in interface FieldElement<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 interface FieldElement<DerivativeStructure>
Parameters:
n - Number of times this must be added to itself.
Returns:
A new element representing n × this.

multiply

public DerivativeStructure multiply(double a)
'×' operator.

Specified by:
multiply in interface RealFieldElement<DerivativeStructure>
Parameters:
a - right hand side parameter of the operator
Returns:
this×a
Since:
3.2

multiply

public DerivativeStructure multiply(DerivativeStructure a)
                             throws DimensionMismatchException
Compute this × a.

Specified by:
multiply in interface FieldElement<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)
'÷s;' operator.

Specified by:
divide in interface RealFieldElement<DerivativeStructure>
Parameters:
a - right hand side parameter of the operator
Returns:
this÷s;a
Since:
3.2

divide

public DerivativeStructure divide(DerivativeStructure a)
                           throws DimensionMismatchException
Compute this ÷ a.

Specified by:
divide in interface FieldElement<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

remainder

public DerivativeStructure remainder(double a)
IEEE remainder operator.

Specified by:
remainder in interface RealFieldElement<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)
                              throws DimensionMismatchException
IEEE remainder operator.

Specified by:
remainder in interface RealFieldElement<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 of this element.

Specified by:
negate in interface FieldElement<DerivativeStructure>
Returns:
the opposite of this.

abs

public DerivativeStructure abs()
absolute value.

Specified by:
abs in interface RealFieldElement<DerivativeStructure>
Returns:
abs(this)
Since:
3.2

ceil

public DerivativeStructure ceil()
Get the smallest whole number larger than instance.

Specified by:
ceil in interface RealFieldElement<DerivativeStructure>
Returns:
ceil(this)
Since:
3.2

floor

public DerivativeStructure floor()
Get the largest whole number smaller than instance.

Specified by:
floor in interface RealFieldElement<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 interface RealFieldElement<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 interface RealFieldElement<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 interface RealFieldElement<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 NaN sign argument is treated as positive.

Specified by:
copySign in interface RealFieldElement<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 NaN sign argument is treated as positive.

Specified by:
copySign in interface RealFieldElement<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 interface RealFieldElement<DerivativeStructure>
Parameters:
n - power of 2
Returns:
this × 2n
Since:
3.2

hypot

public DerivativeStructure hypot(DerivativeStructure y)
                          throws DimensionMismatchException
Returns the hypotenuse of a triangle with sides this and y - sqrt(this2 +y2)
avoiding intermediate overflow or underflow.

Specified by:
hypot in interface RealFieldElement<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)
                                 throws DimensionMismatchException
Returns the hypotenuse of a triangle with sides x and y - sqrt(x2 +y2)
avoiding intermediate overflow or underflow.

Parameters:
x - a value
y - 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)
                            throws DimensionMismatchException
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 to order + 1

reciprocal

public DerivativeStructure reciprocal()
Returns the multiplicative inverse of this element.

Specified by:
reciprocal in interface FieldElement<DerivativeStructure>
Specified by:
reciprocal in interface RealFieldElement<DerivativeStructure>
Returns:
the inverse of this.

sqrt

public DerivativeStructure sqrt()
Square root.

Specified by:
sqrt in interface RealFieldElement<DerivativeStructure>
Returns:
square root of the instance
Since:
3.2

cbrt

public DerivativeStructure cbrt()
Cubic root.

Specified by:
cbrt in interface RealFieldElement<DerivativeStructure>
Returns:
cubic root of the instance
Since:
3.2

rootN

public DerivativeStructure rootN(int n)
Nth root.

Specified by:
rootN in interface RealFieldElement<DerivativeStructure>
Parameters:
n - order of the root
Returns:
nth root of the instance
Since:
3.2

getField

public Field<DerivativeStructure> getField()
Get the Field to which the instance belongs.

Specified by:
getField in interface FieldElement<DerivativeStructure>
Returns:
Field to which the instance belongs

pow

public DerivativeStructure pow(double p)
Power operation.

Specified by:
pow in interface RealFieldElement<DerivativeStructure>
Parameters:
p - power to apply
Returns:
thisp
Since:
3.2

pow

public DerivativeStructure pow(int n)
Integer power operation.

Specified by:
pow in interface RealFieldElement<DerivativeStructure>
Parameters:
n - power to apply
Returns:
thisn
Since:
3.2

pow

public DerivativeStructure pow(DerivativeStructure e)
                        throws DimensionMismatchException
Power operation.

Specified by:
pow in interface RealFieldElement<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 interface RealFieldElement<DerivativeStructure>
Returns:
exponential of the instance
Since:
3.2

expm1

public DerivativeStructure expm1()
Exponential minus 1.

Specified by:
expm1 in interface RealFieldElement<DerivativeStructure>
Returns:
exponential minus one of the instance
Since:
3.2

log

public DerivativeStructure log()
Natural logarithm.

Specified by:
log in interface RealFieldElement<DerivativeStructure>
Returns:
logarithm of the instance
Since:
3.2

log1p

public DerivativeStructure log1p()
Shifted natural logarithm.

Specified by:
log1p in interface RealFieldElement<DerivativeStructure>
Returns:
logarithm of one plus the instance
Since:
3.2

log10

public DerivativeStructure log10()
Base 10 logarithm.

Returns:
base 10 logarithm of the instance

cos

public DerivativeStructure cos()
Cosine operation.

Specified by:
cos in interface RealFieldElement<DerivativeStructure>
Returns:
cos(this)
Since:
3.2

sin

public DerivativeStructure sin()
Sine operation.

Specified by:
sin in interface RealFieldElement<DerivativeStructure>
Returns:
sin(this)
Since:
3.2

tan

public DerivativeStructure tan()
Tangent operation.

Specified by:
tan in interface RealFieldElement<DerivativeStructure>
Returns:
tan(this)
Since:
3.2

acos

public DerivativeStructure acos()
Arc cosine operation.

Specified by:
acos in interface RealFieldElement<DerivativeStructure>
Returns:
acos(this)
Since:
3.2

asin

public DerivativeStructure asin()
Arc sine operation.

Specified by:
asin in interface RealFieldElement<DerivativeStructure>
Returns:
asin(this)
Since:
3.2

atan

public DerivativeStructure atan()
Arc tangent operation.

Specified by:
atan in interface RealFieldElement<DerivativeStructure>
Returns:
atan(this)
Since:
3.2

atan2

public DerivativeStructure atan2(DerivativeStructure x)
                          throws DimensionMismatchException
Two arguments arc tangent operation.

Specified by:
atan2 in interface RealFieldElement<DerivativeStructure>
Parameters:
x - second argument of the arc tangent
Returns:
atan2(this, x)
Throws:
DimensionMismatchException - if number of free parameters or orders are inconsistent
Since:
3.2

atan2

public static DerivativeStructure atan2(DerivativeStructure y,
                                        DerivativeStructure x)
                                 throws DimensionMismatchException
Two arguments arc tangent operation.

Parameters:
y - first argument of the arc tangent
x - 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 interface RealFieldElement<DerivativeStructure>
Returns:
cosh(this)
Since:
3.2

sinh

public DerivativeStructure sinh()
Hyperbolic sine operation.

Specified by:
sinh in interface RealFieldElement<DerivativeStructure>
Returns:
sinh(this)
Since:
3.2

tanh

public DerivativeStructure tanh()
Hyperbolic tangent operation.

Specified by:
tanh in interface RealFieldElement<DerivativeStructure>
Returns:
tanh(this)
Since:
3.2

acosh

public DerivativeStructure acosh()
Inverse hyperbolic cosine operation.

Specified by:
acosh in interface RealFieldElement<DerivativeStructure>
Returns:
acosh(this)
Since:
3.2

asinh

public DerivativeStructure asinh()
Inverse hyperbolic sine operation.

Specified by:
asinh in interface RealFieldElement<DerivativeStructure>
Returns:
asin(this)
Since:
3.2

atanh

public DerivativeStructure atanh()
Inverse hyperbolic tangent operation.

Specified by:
atanh in interface RealFieldElement<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)
              throws MathArithmeticException
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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<DerivativeStructure>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - 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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<DerivativeStructure>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - 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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<DerivativeStructure>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - 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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<DerivativeStructure>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - 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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<DerivativeStructure>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - second factor of the third term
a4 - first factor of the third term
b4 - 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)
                                      throws DimensionMismatchException
Compute a linear combination.

Specified by:
linearCombination in interface RealFieldElement<DerivativeStructure>
Parameters:
a1 - first factor of the first term
b1 - second factor of the first term
a2 - first factor of the second term
b2 - second factor of the second term
a3 - first factor of the third term
b3 - second factor of the third term
a4 - first factor of the third term
b4 - 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.

Overrides:
equals in class Object
Parameters:
other - Object to test for equality to this
Returns:
true if two derivative structures are equal
Since:
3.2

hashCode

public int hashCode()
Get a hashCode for the derivative structure.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object
Since:
3.2


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.