|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.nabla.core.DifferentialPair
public class DifferentialPair
Class representing both a value and a differential.
This class is the workhorse of the Nabla library. It can be seen as an extension of the primitive double type used throughout mathematical expressions. In addition to holding parameter, intermediate computations and result values as double do, instances of this class also holds the first differential associated with this parameter, intermediate computations and results.
DifferentialPair
instances can be used directly thanks to
the arithmetic operators provided as static methods by this class
(+, -, *, /, %) and to the mathematical functions provided by the
NablaMath
and the NablaStrictMath
utility classes.
Implementing complex expressions by hand using these classes is
however a complex and error-prone task, so the classical use is
simply to develop computation code using standard primitive double
values and to use differentiators
to create
the DifferentialPair
-based instances.
Instances of this class are guaranteed to be immutable.
Field Summary | |
---|---|
static DifferentialPair |
E
e (Euler) constant, base of the natural logarithms. |
static DifferentialPair |
MINUS_ONE
-1 constant. |
static DifferentialPair |
ONE
+1 constant. |
static DifferentialPair |
PI
π (Archimede) constant. |
static DifferentialPair |
THREE
+3 constant. |
static DifferentialPair |
TWO
+2 constant. |
static DifferentialPair |
ZERO
0 constant. |
Constructor Summary | |
---|---|
DifferentialPair(double u0,
double u1)
Build a new instance from its components. |
Method Summary | |
---|---|
static DifferentialPair |
add(DifferentialPair a,
DifferentialPair b)
'+' operator, for differential pairs. |
static DifferentialPair |
add(DifferentialPair a,
double b)
'+' operator, for differential pairs. |
static DifferentialPair |
add(DifferentialPair a,
int b)
'+' operator, for differential pairs. |
static DifferentialPair |
add(DifferentialPair a,
long b)
'+' operator, for differential pairs. |
static DifferentialPair |
add(double a,
DifferentialPair b)
'+' operator, for differential pairs. |
static DifferentialPair |
add(int a,
DifferentialPair b)
'+' operator, for differential pairs. |
static DifferentialPair |
add(long a,
DifferentialPair b)
'+' operator, for differential pairs. |
static DifferentialPair |
cube(DifferentialPair a)
cubing operation, for differential pairs. |
static DifferentialPair |
divide(DifferentialPair a,
DifferentialPair b)
'÷s;' operator, for differential pairs. |
static DifferentialPair |
divide(DifferentialPair a,
double b)
'÷s;' operator, for differential pairs. |
static DifferentialPair |
divide(DifferentialPair a,
int b)
'÷s;' operator, for differential pairs. |
static DifferentialPair |
divide(DifferentialPair a,
long b)
'÷s;' operator, for differential pairs. |
static DifferentialPair |
divide(double a,
DifferentialPair b)
'÷s;' operator, for differential pairs. |
static DifferentialPair |
divide(int a,
DifferentialPair b)
'÷s;' operator, for differential pairs. |
static DifferentialPair |
divide(long a,
DifferentialPair b)
'÷s;' operator, for differential pairs. |
double |
getFirstDerivative()
Get the first derivative part of the differential pair. |
double |
getValue()
Get the value part of the differential pair. |
static DifferentialPair |
multiply(DifferentialPair a,
DifferentialPair b)
'×' operator, for differential pairs. |
static DifferentialPair |
multiply(DifferentialPair a,
double b)
'×' operator, for differential pairs. |
static DifferentialPair |
multiply(DifferentialPair a,
int b)
'×' operator, for differential pairs. |
static DifferentialPair |
multiply(DifferentialPair a,
long b)
'×' operator, for differential pairs. |
static DifferentialPair |
multiply(double a,
DifferentialPair b)
'×' operator, for differential pairs. |
static DifferentialPair |
multiply(int a,
DifferentialPair b)
'×' operator, for differential pairs. |
static DifferentialPair |
multiply(long a,
DifferentialPair b)
'×' operator, for differential pairs. |
static DifferentialPair |
negate(DifferentialPair a)
unary '-' operator, for differential pairs. |
static DifferentialPair |
newConstant(double a)
Build an instance representing a constant. |
static DifferentialPair |
newVariable(double a)
Build an instance representing a univariate variable. |
static DifferentialPair |
remainder(DifferentialPair a,
DifferentialPair b)
'%' operator, for differential pairs. |
static DifferentialPair |
remainder(DifferentialPair a,
double b)
'%' operator, for differential pairs. |
static DifferentialPair |
remainder(DifferentialPair a,
int b)
'%' operator, for differential pairs. |
static DifferentialPair |
remainder(DifferentialPair a,
long b)
'%' operator, for differential pairs. |
static DifferentialPair |
remainder(double a,
DifferentialPair b)
'%' operator, for differential pairs. |
static DifferentialPair |
remainder(int a,
DifferentialPair b)
'%' operator, for differential pairs. |
static DifferentialPair |
remainder(long a,
DifferentialPair b)
'%' operator, for differential pairs. |
static DifferentialPair |
square(DifferentialPair a)
squaring operation, for differential pairs. |
static DifferentialPair |
subtract(DifferentialPair a,
DifferentialPair b)
'-' operator, for differential pairs. |
static DifferentialPair |
subtract(DifferentialPair a,
double b)
'-' operator, for differential pairs. |
static DifferentialPair |
subtract(DifferentialPair a,
int b)
'-' operator, for differential pairs. |
static DifferentialPair |
subtract(DifferentialPair a,
long b)
'-' operator, for differential pairs. |
static DifferentialPair |
subtract(double a,
DifferentialPair b)
'-' operator, for differential pairs. |
static DifferentialPair |
subtract(int a,
DifferentialPair b)
'-' operator, for differential pairs. |
static DifferentialPair |
subtract(long a,
DifferentialPair b)
'-' operator, for differential pairs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final DifferentialPair MINUS_ONE
public static final DifferentialPair ZERO
public static final DifferentialPair ONE
public static final DifferentialPair TWO
public static final DifferentialPair THREE
public static final DifferentialPair PI
public static final DifferentialPair E
Constructor Detail |
---|
public DifferentialPair(double u0, double u1)
u0
- value part of the differential pairu1
- first derivative part of the differential pairMethod Detail |
---|
public static DifferentialPair newVariable(double a)
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. Calling this constructor has the same
effect as calling DifferentialPair(a, 1.0)
.
a
- value of the variable
public static DifferentialPair newConstant(double a)
Constant do not vary ... Hence their differential
is 0. Calling this constructor has the same
effect as calling DifferentialPair(a, 0.0)
.
a
- value of the constant
public double getValue()
getFirstDerivative()
public double getFirstDerivative()
getValue()
public static DifferentialPair add(DifferentialPair a, int b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair add(int a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair add(DifferentialPair a, long b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair add(long a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair add(DifferentialPair a, double b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair add(double a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair add(DifferentialPair a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(DifferentialPair a, int b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(int a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(DifferentialPair a, long b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(long a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(DifferentialPair a, double b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(double a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair subtract(DifferentialPair a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(DifferentialPair a, int b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(int a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(DifferentialPair a, long b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(long a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(DifferentialPair a, double b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(double a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair multiply(DifferentialPair a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(DifferentialPair a, int b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(int a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(DifferentialPair a, long b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(long a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(DifferentialPair a, double b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(double a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair divide(DifferentialPair a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(int a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(DifferentialPair a, int b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(long a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(DifferentialPair a, long b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(double a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(DifferentialPair a, double b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair remainder(DifferentialPair a, DifferentialPair b)
a
- left hand side parameter of the operatorb
- right hand side parameter of the operator
public static DifferentialPair negate(DifferentialPair a)
a
- parameter of the operator
public static DifferentialPair square(DifferentialPair a)
a
- parameter of the operator
public static DifferentialPair cube(DifferentialPair a)
a
- parameter of the operator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |