public class ApcomplexNum extends ExprImpl implements IComplexNum
IComplexNum implementation which wraps a
org.apache.commons.math3.complex.Apcomplex value to represent a
numeric complex floating-point number.| Modifier and Type | Field and Description |
|---|---|
static ApcomplexNum |
I
The square root of -1.
|
static ApcomplexNum |
ONE
A complex number representing "1.0 + 0.0i"
|
static ApcomplexNum |
ZERO
A complex number representing "0.0 + 0.0i"
|
ASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID| Modifier and Type | Method and Description |
|---|---|
<T> T |
accept(IVisitor<T> visitor)
Accept a visitor with return type T
|
boolean |
accept(IVisitorBoolean visitor)
Accept a visitor with return type
boolean |
int |
accept(IVisitorInt visitor)
Accept a visitor with return type
int |
long |
accept(IVisitorLong visitor)
Accept a visitor with return type
long |
org.apfloat.Apcomplex |
add(org.apfloat.Apcomplex that) |
ApcomplexNum |
add(ApcomplexNum that) |
IComplexNum |
add(IComplexNum val) |
ApcomplexNum |
apcomplexNumValue(long precision)
Get a
Apcomplex number wrapped into an
ApcomplexNum object. |
org.apfloat.Apcomplex |
apcomplexValue() |
INumber |
ceilFraction()
Returns the smallest (closest to negative infinity)
IInteger
value that is not less than this and is equal to a
mathematical integer. |
int |
compareAbsValueToOne()
Compare the absolute value of this number with
1 and return
1, if the absolute value is greater than 1
0, if the absolute value equals 1
-1, if the absolute value is less than 1
|
int |
compareTo(org.apfloat.Apcomplex that) |
int |
compareTo(IExpr expr)
Compares this expression with the specified expression for order.
|
ComplexNum |
complexNumValue()
Get a
ComplexNum number bject. |
int |
complexSign()
Gets the signum value of a complex number
|
IComplexNum |
conjugate()
Conjugate this (complex-) number.
|
double |
dabs()
Return the absolute value of this complex number.
|
org.apfloat.Apcomplex |
divide(org.apfloat.Apcomplex that) |
ApcomplexNum |
divide(ApcomplexNum that) |
Num |
eabs()
Get the absolute value for a given number
|
boolean |
equals(java.lang.Object obj)
Test if this is equal to b.
|
boolean |
equalsInt(int i)
Check if this number equals the given
int number? |
IExpr |
evaluate(EvalEngine engine)
Evaluate an expression
|
INumber |
floorFraction()
Returns the largest (closest to positive infinity)
IInteger
value that is not greater than this and is equal to a
mathematical integer. |
org.apache.commons.math4.complex.Complex |
getCMComplex() |
org.apfloat.Apcomplex |
getComplex() |
ISignedNumber |
getIm()
Returns the imaginary part of a complex number
|
double |
getImaginary()
Returns the imaginary part of a complex number
|
double |
getImaginaryPart() |
ISignedNumber |
getRe()
Returns the real part of a complex number
|
double |
getReal()
Returns the real part of a complex number
|
double |
getRealPart() |
int |
hashCode()
Hashcode of this Element.
|
ISymbol |
head()
If this object is an instance of
IAST get the first element
(offset 0) of the IAST list (i.e. get(0) ). |
int |
hierarchy()
A unique integer ID for the implementation of this expression
|
IExpr |
inverse()
Returns the multiplicative inverse of this object.
|
boolean |
isSame(IExpr expression,
double epsilon)
Test if this expression equals the given expression.
|
boolean |
isZero()
Test if this expression equals
0 in symbolic or numeric
mode. |
ApcomplexNum |
multiply(ApcomplexNum that) |
IComplexNum |
multiply(IComplexNum val) |
ApcomplexNum |
negate()
Negate this.
|
INumber |
opposite()
Returns an
IExpr whose value is (-1) * this. |
IExpr |
plus(IExpr that)
Returns an
IExpr whose value is (this + that). |
IComplexNum |
pow(IComplexNum val) |
long |
precision() |
org.apfloat.Apcomplex |
subtract(org.apfloat.Apcomplex that) |
ApcomplexNum |
subtract(ApcomplexNum that) |
IExpr |
times(IExpr that)
Returns an
IExpr whose value is (this * that). |
java.lang.String |
toString() |
static ApcomplexNum |
valueOf(org.apfloat.Apcomplex value) |
static ApcomplexNum |
valueOf(org.apfloat.Apfloat real,
org.apfloat.Apfloat imag) |
static ApcomplexNum |
valueOf(java.math.BigInteger realNumerator,
java.math.BigInteger realDenominator,
java.math.BigInteger imagNumerator,
java.math.BigInteger imagDenominator,
int precision)
Create a
ApcomplexNum complex number from the real and
imaginary BigInteger parts. |
static ApcomplexNum |
valueOf(double real,
double imaginary,
long precision) |
static ApcomplexNum |
valueOf(double real,
long precision) |
$div, $minus, $plus, $times, $up, abs, and, apply, apply, asType, copy, dec, divide, egcd, evalComplex, evalDouble, evalNumber, evalSignedNumber, factory, fullFormString, gcd, getAt, inc, internalFormString, internalJavaString, internalScalaString, leafCount, leaves, minus, mod, multiply, negative, optional, or, power, power, remainder, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, replaceSlots, signum, subtract, sum, topHead, toScript, toScriptFactory, variables2Slotsclone, finalize, getClass, notify, notifyAll, wait, wait, wait$div, $minus, $plus, $times, $up, and, apply, apply, asType, dec, divide, evalComplex, evalDouble, evalNumber, evalSignedNumber, evaluateHead, fullFormString, getAt, getField, ifPresent, inc, internalFormString, internalJavaString, internalScalaString, isAllExpanded, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isBlank, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConstant, isCos, isCosh, isDerivative, isDirectedInfinity, isE, isExpanded, isFalse, isFlatAST, isFraction, isFree, isFree, isFree, isFreeAST, isFreeAST, isFreeOfPatterns, isFunction, isGEOrdered, isGTOrdered, isIndeterminate, isInfinity, isInteger, isIntegerResult, isLEOrdered, isList, isListOfLists, isLog, isLTOrdered, isMatrix, isMember, isMember, isMinusOne, isModule, isNegative, isNegativeInfinity, isNegativeResult, isNonNegativeResult, isNot, isNumber, isNumEqualInteger, isNumEqualRational, isNumeric, isNumericFunction, isNumericMode, isNumIntValue, isOne, isONE, isOr, isOrderlessAST, isPattern, isPatternDefault, isPatternExpr, isPatternSequence, isPi, isPlus, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPositive, isPositiveResult, isPower, isPresent, isRational, isRationalResult, isRationalValue, isRealResult, isRuleAST, isSame, isSequence, isSignedNumber, isSin, isSinh, isSlot, isSlotSequence, isSpan, isSymbol, isTan, isTanh, isTimes, isTrue, isUnit, isValue, isVariable, isVector, isZERO, leafCount, leaves, minus, mod, multiply, multiply, negative, ofNullable, optional, or, orElse, orElseGet, orElseThrow, power, power, reciprocal, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceSlots, signum, subtract, sum, timesDistributed, topHead, variables2Slotspublic static final ApcomplexNum I
public static final ApcomplexNum ONE
public static final ApcomplexNum ZERO
public static ApcomplexNum valueOf(org.apfloat.Apcomplex value)
public static ApcomplexNum valueOf(org.apfloat.Apfloat real, org.apfloat.Apfloat imag)
public static ApcomplexNum valueOf(double real, long precision)
public static ApcomplexNum valueOf(double real, double imaginary, long precision)
public static ApcomplexNum valueOf(java.math.BigInteger realNumerator, java.math.BigInteger realDenominator, java.math.BigInteger imagNumerator, java.math.BigInteger imagDenominator, int precision)
ApcomplexNum complex number from the real and
imaginary BigInteger parts.realNumerator - the real numbers numerator partrealDenominator - the real numbers denominator partimagNumerator - the imaginary numbers numerator partimagDenominator - the imaginary numbers denominator partprecision - the precision of the number.ApcomplexNum complex number objectpublic double getImaginaryPart()
getImaginaryPart in interface IComplexNumpublic org.apfloat.Apcomplex apcomplexValue()
public ApcomplexNum apcomplexNumValue(long precision)
INumberApcomplex number wrapped into an
ApcomplexNum object.apcomplexNumValue in interface INumberprecision - set the precision of the resulting ApcomplexNumpublic ComplexNum complexNumValue()
INumberComplexNum number bject.complexNumValue in interface INumberpublic double getRealPart()
getRealPart in interface IComplexNumpublic boolean isZero()
IExpr0 in symbolic or numeric
mode.public int hierarchy()
IExprpublic IComplexNum add(IComplexNum val)
add in interface IComplexNumpublic ApcomplexNum add(ApcomplexNum that)
public IComplexNum multiply(IComplexNum val)
multiply in interface IComplexNumpublic IComplexNum pow(IComplexNum val)
pow in interface IComplexNumpublic org.apfloat.Apcomplex add(org.apfloat.Apcomplex that)
that - public IComplexNum conjugate()
INumberpublic org.apfloat.Apcomplex divide(org.apfloat.Apcomplex that)
that - public ApcomplexNum divide(ApcomplexNum that) throws java.lang.ArithmeticException
java.lang.ArithmeticExceptionpublic boolean equals(java.lang.Object obj)
edu.jas.structure.Elementequals in interface edu.jas.structure.Element<IExpr>equals in class java.lang.Objectpublic IExpr evaluate(EvalEngine engine)
public boolean isSame(IExpr expression, double epsilon)
IExprpublic double dabs()
Returns NaN if either real or imaginary part is
NaN and Double.POSITIVE_INFINITY if neither
part is NaN, but at least one part takes an infinite value.
dabs in interface IComplexNumpublic Num eabs()
INumberpublic int compareAbsValueToOne()
1 and return
1, if the absolute value is greater than 10, if the absolute value equals 1-1, if the absolute value is less than 1compareAbsValueToOne in interface INumberpublic double getImaginary()
INumbergetImaginary in interface INumberpublic double getReal()
INumberpublic final int hashCode()
edu.jas.structure.ElementhashCode in interface edu.jas.structure.Element<IExpr>hashCode in class java.lang.Objectpublic ApcomplexNum multiply(ApcomplexNum that)
that - public ApcomplexNum negate()
ExprImplpublic INumber opposite()
ExprImplIExpr whose value is (-1) * this.
Calculates F.eval(F.Times(F.CN1, this)) in the common case
and uses a specialized implementation for derived number classes.public IExpr plus(IExpr that)
ExprImplIExpr whose value is (this + that).
Calculates F.eval(F.Plus(this, that)) in the common case and
uses a specialized implementation for derived number classes.public IExpr inverse()
ExprImplthis.times(this.inverse()) == ONE , with ONE
being the multiplicative identity. Calculates
F.eval(F.Power(this, F.CN1)) in the common case and uses a
specialized implmentation for derived number classes.public org.apfloat.Apcomplex subtract(org.apfloat.Apcomplex that)
that - public ApcomplexNum subtract(ApcomplexNum that)
public IExpr times(IExpr that)
ExprImplIExpr whose value is (this * that).
Calculates F.eval(F.Times(this, that)) in the common case
and uses a specialized implementation for derived number classes.public java.lang.String toString()
toString in class java.lang.Objectpublic int complexSign()
INumbercomplexSign in interface INumberthis == 0; +1 for
real(this) > 0 or
( real(this)==0 && imaginary(this) > 0 );
-1 for real(this) < 0 || ( real(this) == 0 &&
imaginary(this) < 0 )public int compareTo(org.apfloat.Apcomplex that)
public int compareTo(IExpr expr)
public ISymbol head()
ExprImplIAST get the first element
(offset 0) of the IAST list (i.e. get(0) ).public org.apfloat.Apcomplex getComplex()
public org.apache.commons.math4.complex.Complex getCMComplex()
public <T> T accept(IVisitor<T> visitor)
public boolean accept(IVisitorBoolean visitor)
booleanpublic int accept(IVisitorInt visitor)
intpublic long accept(IVisitorLong visitor)
longpublic boolean equalsInt(int i)
INumberint number?public ISignedNumber getIm()
public ISignedNumber getRe()
public INumber ceilFraction() throws java.lang.ArithmeticException
INumberIInteger
value that is not less than this and is equal to a
mathematical integer. This method raises ArithmeticException if a
numeric value cannot be represented by an long type.ceilFraction in interface INumberIInteger
value that is not less than this and is equal to a
mathematical integer.java.lang.ArithmeticExceptionpublic INumber floorFraction() throws java.lang.ArithmeticException
INumberIInteger
value that is not greater than this and is equal to a
mathematical integer. ArithmeticException if a numeric value cannot
be represented by an long type.floorFraction in interface INumberIInteger
value that is not greater than this and is equal to
a mathematical integer.java.lang.ArithmeticExceptionpublic long precision()
throws org.apfloat.ApfloatRuntimeException
org.apfloat.ApfloatRuntimeException