|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjmathlib.core.interpreter.RootObject
jmathlib.core.tokens.Token
jmathlib.core.tokens.OperandToken
jmathlib.core.tokens.DataToken
jmathlib.core.tokens.SparseNumberToken
public class SparseNumberToken
Class representing numbers used in expression holds a 2D array of complex numers in a 3d array values[y][x][REAL/IMAGINARY] All operations on a DoubleNumberToken create a new DoubleNumberToken
| Field Summary | |
|---|---|
static DoubleNumberToken |
j
Constant value set to j |
static DoubleNumberToken |
one
Constant value set to 1 |
static DoubleNumberToken |
two
Constant value set to 2 |
static DoubleNumberToken |
zero
Constant value set to 0 |
| Fields inherited from class jmathlib.core.tokens.DataToken |
|---|
dataType, noElem, sizeA, sizeX, sizeY |
| Fields inherited from class jmathlib.core.tokens.Token |
|---|
priority |
| Fields inherited from interface jmathlib.core.constants.TokenConstants |
|---|
ADDSUB_PRIORITY, AND_PRIORITY, ANDAND_PRIORITY, ASSIGN_PRIORITY, BRACKET_PRIORITY, COMPARE_PRIORITY, CONCAT, MATRIX, MULDIV_PRIORITY, OR_PRIORITY, OROR_PRIORITY, PARAMETER, POWER_PRIORITY, RELATION_PRIORITY, SINGLE, ttDelimiter, ttNotSet, ttOperand, ttOperator |
| Fields inherited from interface jmathlib.core.constants.ErrorCodes |
|---|
ERR_BRACKET_OPEN, ERR_BRACKET_ORDER, ERR_FUNCTION_NOT_FOUND, ERR_FUNCTION_NOT_IMPLEMENTED, ERR_INSUFFICIENT_PARAMETERS, ERR_INVALID_PARAMETER, ERR_LVALUE_REQUIRED, ERR_MATRIX_SINGULAR, ERR_NOT_SQUARE_MATRIX, ERR_OPNOTSUPPORTED, ERR_TOO_MANY_PARAMETERS, ERR_USER_ERROR, ERR_VARIABLE_NOTDEFINED, OK, OK_FUNCTION_PROCESS |
| Constructor Summary | |
|---|---|
SparseNumberToken()
Constructor creating empty number token |
|
SparseNumberToken(double _value)
Constructor creating a scalar taking the numbers value as a double |
|
SparseNumberToken(double[] _values)
Constructor taking the numbers value as a pair of double values representing real and imaginary part |
|
SparseNumberToken(double[][] _values)
Constructor taking the numbers value as a double[][] |
|
SparseNumberToken(double[][][] _values)
Constructor taking the numbers value as a double[][][] |
|
SparseNumberToken(double[][] _real,
double[][] _imaginary)
Constructor taking the numbers value as two double[][] |
|
SparseNumberToken(double _real,
double _imaginary)
Constructor taking the numbers value as a pair of double values representing real and imaginary part |
|
SparseNumberToken(java.lang.String _value)
Constructor creating a scalar taking the numbers value as a string |
|
SparseNumberToken(java.lang.String _real,
java.lang.String _imaginary)
Constructor taking the numbers value as a string |
|
| Method Summary | |
|---|---|
OperandToken |
abs()
Standard functions - absolute value |
OperandToken |
acos()
trigonometric functions - calculate the arc cosine of this token |
double[] |
acos(double[] arg)
Calculates the arccosine of a complex number |
OperandToken |
acosh()
Trigonometric function - calculates the inverse hyperbolic cosine |
double[] |
acosh(double[] arg)
Calculates the inverse hyperbolic cosine of a complex number |
OperandToken |
add(OperandToken arg)
add arg to this object for a number token |
double |
arg(int y,
int x)
calculate the arg of the complex number at y, x |
OperandToken |
asin()
trigonometric functions - calculate the arc sine of this token |
double[] |
asin(double[] arg)
Calculates the arcsine of a complex number |
OperandToken |
asinh()
Trigonometric function - calculates the inverse hyperbolic sine |
double[] |
asinh(double[] arg)
Calculates the inverse hyperbolic sine of a complex number |
OperandToken |
atan()
trigonometric functions - calculate the arc tangent of this token |
double[] |
atan(double[] arg)
Calculates the arctangent of a complex number |
OperandToken |
atanh()
Trigonometric function - calculates the inverse hyperbolic tangent |
double[] |
atanh(double[] arg)
Calculates the inverse hyperbolic tangent of a complex number |
OperandToken |
ceil()
Standard functions - rounds the value up |
OperandToken |
conjugate()
Complex function - calculates the complex conjugate of the number |
OperandToken |
cos()
trigonometric functions - calculate the cosine of this token |
double[] |
cos(double[] arg)
Calculates the cosine of a complex number |
OperandToken |
cosh()
Trigonometric function - calculates the hyperbolic cosine |
double[] |
cosh(double[] arg)
Calculates the hyperbolic cosine of a complex number |
OperandToken |
ctranspose()
calculate the conjugate transpose of a matrix |
OperandToken |
degreesToRadians()
|
double[] |
divide(double[] arg1,
double[] arg2)
divide two complex numbers and return a complex number again, pay special attention to infinity and not a number |
OperandToken |
divide(OperandToken arg)
divide this object by arg for a number token |
boolean |
equals(java.lang.Object arg)
Check if two tokens are equal |
OperandToken |
evaluate(Token[] operands,
GlobalValues globals)
Evaluate the token. |
OperandToken |
exp()
Standard functions - calculates the exponent |
double[] |
exp(double[] arg)
Calculates the exponent of a complex number |
OperandToken |
factorial()
Standard functions - calculates the factorial of the number |
double |
factorial(double amount)
Calulates the factorial of a real value |
OperandToken |
floor()
Standard functions - rounds the value down |
DataToken |
getElementSized(int y,
int x)
return a new Number Token of size y*x |
double[][] |
getImValues()
|
int |
getIntValue(int y,
int x)
|
double[][] |
getReValues()
|
double |
getValue()
|
double |
getValueAbs(int y,
int x)
|
double |
getValueArg(int y,
int x)
|
double[] |
getValueComplex(int y,
int x)
|
double |
getValueIm()
|
double |
getValueIm(int y,
int x)
|
double |
getValueRe(int y,
int x)
|
double[][] |
getValuesImg()
|
double[][] |
getValuesSSSSS()
|
boolean |
isComplex()
|
boolean |
isImaginary()
|
boolean |
isInteger()
|
boolean |
isNull()
Checks if this operand is zero |
boolean |
isNumeric()
Checks if this operand is a numeric value |
boolean |
isReal()
|
boolean |
isScalar()
|
OperandToken |
leftDivide(OperandToken arg)
left divide |
OperandToken |
ln()
Standard functions - calculates the natural logarythm |
OperandToken |
log()
Standard functions - calculates the logarythm |
double[] |
log(double[] arg)
Calculates the logarythm of a complex number |
OperandToken |
max(RootObject arg)
Standard functions - calculates the maximum of two values |
OperandToken |
min(RootObject arg)
Standard functions - calculates the minimum of two values |
double[] |
multiply(double[] arg1,
double[] arg2)
Multiplies two complex numbers |
OperandToken |
multiply(OperandToken arg)
multiply arg by this object for a number token |
OperandToken |
negate()
standard function - returns the negative of the number |
OperandToken |
power(OperandToken arg)
Raise this object to the power of arg |
OperandToken |
radiansToDegrees()
|
OperandToken |
round()
Standard functions - rounds the value to the nearest integer |
OperandToken |
scalarDivide(OperandToken arg)
scalar divide arg by this object for a number token |
OperandToken |
scalarLeftDivide(OperandToken arg)
scalar left divide |
OperandToken |
scalarMultiply(OperandToken arg)
scalar multiply arg by this object for a number token |
void |
setElement(int y,
int x,
OperandToken num)
|
void |
setElement(int n,
OperandToken num)
|
void |
setSize(int dy,
int dx)
increase/decrease the size of the current DoubleNumberToken to size y*x |
void |
setValue(int y,
int x,
double _real,
double _imag)
Set value at position y, x |
void |
setValueComplex(int y,
int x,
double[] _value)
Set value at position y, x |
OperandToken |
sin()
trigonometric functions - calculate the sine of this token |
double[] |
sin(double[] arg)
Calculates the sine of a complex number |
OperandToken |
sinh()
Trigonometric function - calculates the hyperbolic sine |
double[] |
sinh(double[] arg)
Calculates the hyperbolic sine of a complex number |
OperandToken |
sqrt()
Standard functions - calculates the square root |
double[] |
sqrt(double[] arg)
Calculates the sqrt of a complex number |
OperandToken |
subtract(OperandToken arg)
subtract arg from this object for a number token |
OperandToken |
tan()
trigonometric functions - calculate the tangent of this token |
double[] |
tan(double[] arg)
Calculates the tangent of a complex number |
OperandToken |
tanh()
Trigonometric function - calculates the hyperbolic tan |
double[] |
tanh(double[] arg)
Calculates the hyperbolic tangent of a complex number |
java.lang.String |
toString()
return the number as a string |
java.lang.String |
toString(double[] _values)
create string representation of (complex) double values |
OperandToken |
transpose()
calculate the transpose of a matrix |
| Methods inherited from class jmathlib.core.tokens.DataToken |
|---|
checkEqualDimensions, getDataType, getDimensions, getElement, getElement, getNumberOfElements, getSize, getSizeX, getSizeY |
| Methods inherited from class jmathlib.core.tokens.OperandToken |
|---|
asArray, Children, derivative, expand, integral, isLeaf, mpower, mPower, simplify, subst |
| Methods inherited from class jmathlib.core.tokens.Token |
|---|
isDisplayResult, setDisplayResult, toMathMlString, toString |
| Methods inherited from class jmathlib.core.interpreter.RootObject |
|---|
clone, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final DoubleNumberToken one
public static final DoubleNumberToken zero
public static final DoubleNumberToken two
public static final DoubleNumberToken j
| Constructor Detail |
|---|
public SparseNumberToken()
public SparseNumberToken(java.lang.String _value)
_value - = the numbers value as a stringpublic SparseNumberToken(double _value)
_value - = the numbers value as a doublepublic SparseNumberToken(double[][] _values)
_value - = the numbers value as a 2D array of double
public SparseNumberToken(java.lang.String _real,
java.lang.String _imaginary)
_real - = the numbers real value as a string_imaginary - = the numbers imaginary value as a string
public SparseNumberToken(double _real,
double _imaginary)
_real - = the numbers real value as a double_imaginary - = the numbers imaginary value as a doublepublic SparseNumberToken(double[] _values)
_values - = the values as a array containing the real and
imaginary values
public SparseNumberToken(double[][] _real,
double[][] _imaginary)
_real - = the numbers value as a 2D array of double_imaginary - = the numbers value as a 2D array of doublepublic SparseNumberToken(double[][][] _values)
_values - = the numbers value as a 3D array of double| Method Detail |
|---|
public DataToken getElementSized(int y,
int x)
getElementSized in class DataToken
public void setSize(int dy,
int dx)
setSize in class DataTokendy - number of rowsdx - number of columnspublic double getValue()
public double getValueRe(int y,
int x)
public int getIntValue(int y,
int x)
public double getValueIm()
public double getValueIm(int y,
int x)
public double getValueAbs(int y,
int x)
public double getValueArg(int y,
int x)
public double[][] getValuesSSSSS()
public double[][] getReValues()
public double[][] getImValues()
public double[][] getValuesImg()
public void setElement(int y,
int x,
OperandToken num)
setElement in class DataToken
public void setElement(int n,
OperandToken num)
setElement in class DataToken
public double[] getValueComplex(int y,
int x)
y - = y position in matrixx - = x position in matrix
public void setValueComplex(int y,
int x,
double[] _value)
y - = y position in matrixx - = x position in matrix_value - = the value to set it to as an array of doublesimag - = imaginary value
public void setValue(int y,
int x,
double _real,
double _imag)
y - = y position in matrixx - = x position in matrixreal - = real valueimag - = imaginary valuepublic java.lang.String toString()
toString in class Tokenpublic java.lang.String toString(double[] _values)
_values[]={REAL,IMAGINARY} - real and imaginary part of number
public OperandToken evaluate(Token[] operands,
GlobalValues globals)
evaluate in class Tokenoperands - = an array of RootObject containing the tokens operands
public boolean equals(java.lang.Object arg)
equals in class java.lang.Objectarg - = the object to check against
public double arg(int y,
int x)
public OperandToken add(OperandToken arg)
add in class OperandToken= - the value to add to it
public OperandToken subtract(OperandToken arg)
subtract in class OperandToken= - the value to subtract
public OperandToken power(OperandToken arg)
power in class OperandToken= - the value to raise it to the power of
public OperandToken multiply(OperandToken arg)
multiply in class OperandTokenarg - = the value to multiply it by
public double[] multiply(double[] arg1,
double[] arg2)
arg1 - = the first complex number as an array of doublearg2 - = the second complex number as an array of double
public OperandToken divide(OperandToken arg)
divide in class OperandTokenarg - = the value to divide it by
public double[] divide(double[] arg1,
double[] arg2)
arg1 - = the first complex number as an array of doublearg2 - = the second complex number as an array of double
public OperandToken scalarMultiply(OperandToken arg)
scalarMultiply in class OperandTokenarg - = the amount to multiply it by
public OperandToken scalarDivide(OperandToken arg)
scalarDivide in class OperandTokenarg - = the amount to divide it by
public OperandToken leftDivide(OperandToken arg)
leftDivide in class OperandTokenpublic OperandToken scalarLeftDivide(OperandToken arg)
scalarLeftDivide in class OperandTokenpublic OperandToken transpose()
transpose in class OperandTokenpublic OperandToken ctranspose()
ctranspose in class OperandTokenpublic OperandToken sin()
public double[] sin(double[] arg)
arg - = the angle as an array of double
public OperandToken cos()
public double[] cos(double[] arg)
arg - = the angle as an array of double
public OperandToken tan()
public double[] tan(double[] arg)
arg - = the angle as an array of double
public OperandToken asin()
public double[] asin(double[] arg)
arg - = the value as an array of double
public OperandToken acos()
public double[] acos(double[] arg)
arg - = the value as an array of double
public OperandToken atan()
public double[] atan(double[] arg)
arg - = the value as an array of double
public OperandToken sinh()
public double[] sinh(double[] arg)
arg - = the angle as an array of double
public OperandToken cosh()
public double[] cosh(double[] arg)
arg - = the angle as an array of double
public OperandToken tanh()
public double[] tanh(double[] arg)
arg - = the angle as an array of double
public OperandToken asinh()
public double[] asinh(double[] arg)
arg - = the value as an array of double
public OperandToken acosh()
public double[] acosh(double[] arg)
arg - = the angle as an array of double
public OperandToken atanh()
public double[] atanh(double[] arg)
arg - = the angle as an array of double
public OperandToken exp()
public double[] exp(double[] arg)
arg - = the value as an array of double
public OperandToken ln()
public OperandToken log()
public double[] log(double[] arg)
arg - = the value as an array of double
public OperandToken sqrt()
public double[] sqrt(double[] arg)
arg - = the value as an array of double
public OperandToken abs()
public OperandToken floor()
public OperandToken ceil()
public OperandToken round()
public OperandToken negate()
negate in class OperandTokenpublic OperandToken min(RootObject arg)
public OperandToken max(RootObject arg)
public OperandToken factorial()
factorial in class OperandTokenpublic double factorial(double amount)
amount - = the number to calc the factorial of
public OperandToken conjugate()
public boolean isNull()
isNull in class OperandTokenpublic boolean isNumeric()
isNumeric in class OperandTokenpublic boolean isScalar()
public boolean isReal()
public boolean isInteger()
public boolean isImaginary()
public boolean isComplex()
public OperandToken degreesToRadians()
public OperandToken radiansToDegrees()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||