org.matheclipse.core.expression
Class ComplexNum
- java.lang.Object
-
- org.matheclipse.core.expression.ExprImpl
-
- org.matheclipse.core.expression.ComplexNum
-
- All Implemented Interfaces:
- AbelianGroupElem<IExpr>, Element<IExpr>, MonoidElem<IExpr>, RingElem<IExpr>, java.io.Serializable, java.lang.Comparable<IExpr>, IComplexNum, IExpr, INumber
public class ComplexNum extends ExprImpl implements IComplexNum
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static ComplexNumIThe square root of -1.static ComplexNumNaNA complex number representing "NaN + NaNi"static ComplexNumONEA complex number representing "1.0 + 0.0i"static ComplexNumZEROA complex number representing "0.0 + 0.0i"-
Fields inherited from interface org.matheclipse.core.interfaces.IExpr
ASTID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description <T> Taccept(IVisitor<T> visitor)Accept a visitor with return type Tbooleanaccept(IVisitorBoolean visitor)Accept a visitor with return typebooleanintaccept(IVisitorInt visitor)Accept a visitor with return typeintComplexadd(Complex that)ComplexNumadd(ComplexNum that)IComplexNumadd(IComplexNum val)intcompareTo(Complex that)intcompareTo(IExpr obj)Compares this expression with the specified expression for order.intcomplexSign()Gets the signum value of a complex numberIComplexNumconjugate()doubledabs()Return the absolute value of this complex number.Complexdivide(Complex that)ComplexNumdivide(ComplexNum that)Numeabs()Get the absolute value for a given numberbooleanequals(java.lang.Object obj)Test if this is equal to b.booleanequalsInt(int i)Is this number equal an integer number?IExprevaluate(EvalEngine engine)Evaluate an expressionComplexgetCMComplex()ComplexgetComplex()ISignedNumbergetIm()Returns the imaginary part of a complex numberdoublegetImaginary()doublegetImaginaryPart()ISignedNumbergetRe()Returns the real part of a complex numberdoublegetReal()doublegetRealPart()inthashCode()Hashcode of this Element.ISymbolhead()If this object is an instance ofIASTget the first element (offset 0) of theIASTlist (i.e.inthierarchy()A unique integer ID for the implementation of this expressionIExprinverse()Returns the multiplicative inverse of this object.booleanisInfinite()booleanisNaN()booleanisSame(IExpr expression, double epsilon)Test if this expression equals the given expression.booleanisZero()Test if this expression equals0in symbolic or numeric mode.ComplexNummultiply(ComplexNum that)IComplexNummultiply(IComplexNum val)ComplexNumnegate()Negate this.INumberopposite()IExprplus(IExpr that)IComplexNumpow(IComplexNum val)Complexsubtract(Complex that)ComplexNumsubtract(ComplexNum that)IExprtimes(IExpr that)Returns the product of this object with the one specified.java.lang.StringtoString()static ComplexNumvalueOf(double real)static ComplexNumvalueOf(double real, double imaginary)static ComplexNumvalueOf(INum d)-
Methods inherited from class org.matheclipse.core.expression.ExprImpl
abs, and, apply, apply, asType, copy, divide, egcd, factory, fullFormString, gcd, getAt, internalFormString, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConstant, isCos, isCosh, isDirectedInfinity, isFalse, isFlatAST, isFraction, isFree, isFree, isFunction, isGEOrdered, isGTOrdered, isInfinity, isInteger, isLEOrdered, isList, isListOfLists, isLog, isLTOrdered, isMatrix, isMember, isMember, isMinusOne, isModule, isNegative, isNegativeInfinity, isNot, isNumber, isNumEqualInteger, isNumeric, isNumericFunction, isNumIntValue, isOne, isONE, isOr, isOrderlessAST, isPattern, isPatternExpr, isPatternSequence, isPlus, isPositive, isPower, isRational, isRealFunction, isRuleAST, isSame, isSequence, isSignedNumber, isSin, isSinh, isSlot, isSlotSequence, isSymbol, isTan, isTanh, isTimes, isTrue, isUnit, isValue, isVector, isZERO, leaves, minus, mod, multiply, negative, or, power, power, remainder, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, replaceSlots, signum, subtract, sum, topHead, toScript, toScriptFactory, variables2Slots
-
Methods inherited from interface org.matheclipse.core.interfaces.IExpr
and, apply, apply, asType, fullFormString, getAt, internalFormString, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isConstant, isCos, isCosh, isDirectedInfinity, isFalse, isFlatAST, isFraction, isFree, isFree, isFunction, isGEOrdered, isGTOrdered, isInfinity, isInteger, isLEOrdered, isList, isListOfLists, isLog, isLTOrdered, isMatrix, isMember, isMember, isMinusOne, isModule, isNegative, isNegativeInfinity, isNot, isNumber, isNumEqualInteger, isNumeric, isNumericFunction, isNumIntValue, isOne, isOr, isOrderlessAST, isPattern, isPatternExpr, isPatternSequence, isPlus, isPositive, isPower, isRational, isRealFunction, isRuleAST, isSame, isSequence, isSignedNumber, isSin, isSinh, isSlot, isSlotSequence, isSymbol, isTan, isTanh, isTimes, isTrue, isValue, isVector, leaves, minus, mod, multiply, negative, or, power, power, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceSlots, signum, topHead, variables2Slots
-
Methods inherited from interface edu.jas.structure.AbelianGroupElem
abs, isZERO, subtract, sum
-
Methods inherited from interface edu.jas.structure.MonoidElem
divide, isONE, isUnit, remainder
-
Methods inherited from interface edu.jas.structure.Element
copy, factory, toScript, toScriptFactory
-
-
-
-
Field Detail
-
I
public static final ComplexNum I
The square root of -1. A number representing "0.0 + 1.0i"
-
NaN
public static final ComplexNum NaN
A complex number representing "NaN + NaNi"
-
ONE
public static final ComplexNum ONE
A complex number representing "1.0 + 0.0i"
-
ZERO
public static final ComplexNum ZERO
A complex number representing "0.0 + 0.0i"
-
-
Method Detail
-
valueOf
public static ComplexNum valueOf(INum d)
-
valueOf
public static ComplexNum valueOf(double real)
-
valueOf
public static ComplexNum valueOf(double real, double imaginary)
-
getImaginaryPart
public double getImaginaryPart()
- Specified by:
getImaginaryPartin interfaceIComplexNum- Returns:
-
getRealPart
public double getRealPart()
- Specified by:
getRealPartin interfaceIComplexNum- Returns:
-
isZero
public boolean isZero()
Description copied from interface:IExprTest if this expression equals0in symbolic or numeric mode.
-
hierarchy
public int hierarchy()
Description copied from interface:IExprA unique integer ID for the implementation of this expression
-
add
public IComplexNum add(IComplexNum val)
- Specified by:
addin interfaceIComplexNum
-
add
public ComplexNum add(ComplexNum that)
-
multiply
public IComplexNum multiply(IComplexNum val)
- Specified by:
multiplyin interfaceIComplexNum
-
pow
public IComplexNum pow(IComplexNum val)
- Specified by:
powin interfaceIComplexNum
-
conjugate
public IComplexNum conjugate()
- Specified by:
conjugatein interfaceIComplexNum- Returns:
-
divide
public ComplexNum divide(ComplexNum that) throws java.lang.ArithmeticException
- Throws:
java.lang.ArithmeticException
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:ElementTest if this is equal to b.
-
evaluate
public IExpr evaluate(EvalEngine engine)
Evaluate an expression
-
isSame
public boolean isSame(IExpr expression, double epsilon)
Description copied from interface:IExprTest if this expression equals the given expression. If the compared expressions are of the same numeric type, they are equal to a given EPSILON
-
dabs
public double dabs()
Return the absolute value of this complex number.Returns
NaNif either real or imaginary part isNaNandDouble.POSITIVE_INFINITYif neither part isNaN, but at least one part takes an infinite value.- Specified by:
dabsin interfaceIComplexNum- Returns:
- the absolute value
-
eabs
public Num eabs()
Description copied from interface:INumberGet the absolute value for a given number
-
getImaginary
public double getImaginary()
- Returns:
-
getReal
public double getReal()
- Returns:
-
hashCode
public final int hashCode()
Description copied from interface:ElementHashcode of this Element.
-
isInfinite
public boolean isInfinite()
- Returns:
-
isNaN
public boolean isNaN()
- Returns:
-
multiply
public ComplexNum multiply(ComplexNum that)
- Parameters:
that-- Returns:
-
negate
public ComplexNum negate()
Description copied from interface:AbelianGroupElemNegate this.- Specified by:
negatein interfaceAbelianGroupElem<IExpr>- Overrides:
negatein classExprImpl- Returns:
-
opposite
public INumber opposite()
-
inverse
public IExpr inverse()
Description copied from interface:IExprReturns the multiplicative inverse of this object. It is the object such asthis.times(this.inverse()) == ONE, withONEbeing the multiplicative identity.
-
subtract
public ComplexNum subtract(ComplexNum that)
-
times
public IExpr times(IExpr that)
Description copied from interface:IExprReturns the product of this object with the one specified.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
complexSign
public int complexSign()
Description copied from interface:INumberGets the signum value of a complex number- Specified by:
complexSignin interfaceINumber- Returns:
-
compareTo
public int compareTo(Complex that)
-
compareTo
public int compareTo(IExpr obj)
Compares this expression with the specified expression for order. Returns a negative integer, zero, or a positive integer as this expression is canonical less than, equal to, or greater than the specified expression.
-
head
public ISymbol head()
Description copied from interface:IExprIf this object is an instance ofIASTget the first element (offset 0) of theIASTlist (i.e. get(0) ).
-
getComplex
public Complex getComplex()
-
getCMComplex
public Complex getCMComplex()
-
accept
public <T> T accept(IVisitor<T> visitor)
Accept a visitor with return type T
-
accept
public boolean accept(IVisitorBoolean visitor)
Accept a visitor with return typeboolean
-
accept
public int accept(IVisitorInt visitor)
Accept a visitor with return typeint
-
equalsInt
public boolean equalsInt(int i)
Description copied from interface:INumberIs this number equal an integer number?
-
getIm
public ISignedNumber getIm()
Returns the imaginary part of a complex number
-
getRe
public ISignedNumber getRe()
Returns the real part of a complex number
-
-
DMelt 3.0 © DataMelt by jWork.ORG