public abstract class AbstractFractionSym extends ExprImpl implements IFraction
FractionSym,
BigFractionSym,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static FractionSym |
MONE |
static FractionSym |
ONE |
static FractionSym |
ZERO |
ASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID| Constructor and Description |
|---|
AbstractFractionSym() |
| Modifier and Type | Method and Description |
|---|---|
abstract IFraction |
abs()
Compute the absolute of this rational.
|
<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 |
abstract IFraction |
add(IFraction other) |
IFraction |
addmul(IFraction fac1,
IFraction fac2)
Returns
this+(fac1*fac2). |
ApcomplexNum |
apcomplexNumValue(long precision)
Get a
Apcomplex number wrapped into an
ApcomplexNum object. |
org.apfloat.Apcomplex |
apcomplexValue(long precision) |
ApfloatNum |
apfloatNumValue(long precision)
Get a
Apfloat number wrapped into an ApfloatNum object. |
abstract IFraction |
ceilFraction()
Returns the smallest (closest to negative infinity)
IInteger
value that is not less than this and is equal to a
mathematical integer. |
int |
complexSign()
Gets the signum value of a complex number
|
IRational |
divideBy(IRational that) |
ISignedNumber |
divideBy(ISignedNumber that)
Divide
this signed number by that signed number. |
IExpr |
eabs()
Get the absolute value for a given number
|
boolean |
equalsInt(int i)
Check if this number equals the given
int number? |
IExpr |
evaluate(EvalEngine engine)
Evaluate an expression
|
IAST |
factorInteger()
Return the factors paired with their exponents for integer and fractional
numbers.
|
abstract IFraction |
floorFraction()
Returns the largest (closest to positive infinity)
IInteger
value that is not greater than this and is equal to a
mathematical integer. |
static java.math.BigInteger |
gcd(java.math.BigInteger i1,
java.math.BigInteger i2) |
IInteger |
getDenominator()
Returns the denominator of this fraction.
|
ISignedNumber |
getIm()
Returns the imaginary part of a complex number
|
double |
getImaginary()
Returns the imaginary part of a complex number
|
IInteger |
getNumerator()
Returns the numerator of this fraction.
|
ISignedNumber |
getRe()
Returns the real part of a complex number
|
double |
getReal()
Returns the real part of a complex number
|
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
|
abstract IFraction |
inverse()
Returns the multiplicative inverse of this object.
|
boolean |
isGreaterThan(ISignedNumber obj)
Test if
this signed number is greater than that signed number.. |
abstract boolean |
isIntegral()
Check whether this rational represents an integral value (i.e. the
denominator equals 1).
|
boolean |
isLessThan(ISignedNumber obj)
Test if
this signed number is less than that signed number.. |
boolean |
isNumEqualRational(IRational value)
Check if this expression equals an
IRational value. |
boolean |
isRationalValue(IRational value)
Test if this expression equals
value in symbolic or numeric
mode. |
IFraction |
mul(IFraction other)
Return a new rational representing
this * other. |
IFraction |
multiply(IFraction parm1) |
abstract IFraction |
negate()
Negate this.
|
INumber |
numericNumber()
Create a numeric number from this exact "symbolic" number.
|
Num |
numValue()
Get a Java double number wrapped into a
Num object. |
ISignedNumber |
opposite()
Returns an
IExpr whose value is (-1) * this. |
IExpr |
plus(IExpr that)
Returns an
IExpr whose value is (this + that). |
IFraction |
pow(long n)
Returns this number raised at the specified exponent.
|
int |
sign()
Returns the signum function of this number (i.e., -1, 0 or 1 as the value of this number is negative, zero or positive).
|
IFraction |
sub(IFraction other)
Return a new rational representing
this - other. |
IFraction |
subdiv(IFraction s,
FractionSym d)
Returns
(this-s)/d. |
IRational |
subtract(IRational that) |
ISignedNumber |
subtractFrom(ISignedNumber that)
Subtract
that signed number from this signed number |
IExpr |
times(IExpr that)
Returns an
IExpr whose value is (this * that). |
static IFraction |
valueOf(org.apache.commons.math4.fraction.BigFraction fraction) |
static IFraction |
valueOf(java.math.BigInteger num) |
static IFraction |
valueOf(java.math.BigInteger num,
java.math.BigInteger den)
Construct a rational from two BigIntegers.
|
static IFraction |
valueOf(double value) |
static IFraction |
valueOf(IInteger numerator) |
static IFraction |
valueOf(IInteger numerator,
IInteger denominator) |
static IFraction |
valueOf(long newnum,
long newdenom)
Construct a rational from two longs.
|
$div, $minus, $plus, $times, $up, and, apply, apply, asType, compareTo, conjugate, 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdiv, divideAndRemainder, getBigDenominator, getBigNumerator, getRational, normalizeadd, ceil, compareInt, equalsFraction, floor, getFraction, multiplydoubleValue, isNegative, isPositive, isZero, round, toInt, toLongcompareAbsValueToOne, complexNumValue, conjugate$div, $minus, $plus, $times, $up, and, apply, apply, asType, compareTo, 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, isNegativeInfinity, isNegativeResult, isNonNegativeResult, isNot, isNumber, isNumEqualInteger, isNumeric, isNumericFunction, isNumericMode, isNumIntValue, isOne, isONE, isOr, isOrderlessAST, isPattern, isPatternDefault, isPatternExpr, isPatternSequence, isPi, isPlus, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPositiveResult, isPower, isPresent, isRational, isRationalResult, isRealResult, isRuleAST, isSame, 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 FractionSym ZERO
public static final FractionSym ONE
public static final FractionSym MONE
public static java.math.BigInteger gcd(java.math.BigInteger i1,
java.math.BigInteger i2)
public static IFraction valueOf(org.apache.commons.math4.fraction.BigFraction fraction)
public static IFraction valueOf(java.math.BigInteger num)
public static IFraction valueOf(java.math.BigInteger num, java.math.BigInteger den)
num - Numeratorden - Denominatorpublic static IFraction valueOf(double value)
public static IFraction valueOf(long newnum, long newdenom)
newnum - Numerator.newdenom - Denominator.public abstract IFraction abs()
public <T> T accept(IVisitor<T> visitor)
public boolean accept(IVisitorBoolean visitor)
booleanpublic int accept(IVisitorInt visitor)
intpublic long accept(IVisitorLong visitor)
longpublic ApcomplexNum apcomplexNumValue(long precision)
INumberApcomplex number wrapped into an
ApcomplexNum object.apcomplexNumValue in interface INumberprecision - set the precision of the resulting ApcomplexNumpublic org.apfloat.Apcomplex apcomplexValue(long precision)
public ApfloatNum apfloatNumValue(long precision)
ISignedNumberApfloat number wrapped into an ApfloatNum object.apfloatNumValue in interface ISignedNumberprecision - set the precision of the resulting ApfloatNumpublic abstract IFraction ceilFraction()
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.public int complexSign()
complexSign 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 ISignedNumber divideBy(ISignedNumber that)
this signed number by that signed number.divideBy in interface ISignedNumberthat - a signed numberpublic IExpr eabs()
INumberpublic boolean equalsInt(int i)
INumberint number?public IExpr evaluate(EvalEngine engine)
public IAST factorInteger()
IRational
factorInteger(-4) ==> {{-1,1},{2,2}}
factorInteger in interface IRationalpublic abstract IFraction floorFraction()
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.public IInteger getDenominator()
getDenominator in interface IRationalpublic ISignedNumber getIm()
INumberpublic IInteger getNumerator()
getNumerator in interface IRationalpublic ISignedNumber getRe()
INumberpublic ISymbol head()
ExprImplIAST get the first element
(offset 0) of the IAST list (i.e. get(0) ).public int hierarchy()
IExprpublic abstract IFraction 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 boolean isGreaterThan(ISignedNumber obj)
ISignedNumberthis signed number is greater than that signed number..isGreaterThan in interface ISignedNumberthis > thatpublic abstract boolean isIntegral()
true iff value is integral.public boolean isLessThan(ISignedNumber obj)
ISignedNumberthis signed number is less than that signed number..isLessThan in interface ISignedNumberthis < thatpublic boolean isNumEqualRational(IRational value) throws java.lang.ArithmeticException
IRational value. The
value of an IInteger, IFraction or the value of
an INum object can be equal to value.isNumEqualRational in interface IExprjava.lang.ArithmeticExceptionIExpr.isRational()public boolean isRationalValue(IRational value)
value in symbolic or numeric
mode.isRationalValue in interface IExprpublic abstract IFraction negate()
ExprImplnegate in interface edu.jas.structure.AbelianGroupElem<IExpr>negate in interface org.apache.commons.math4.FieldElement<IExpr>negate in interface IFractionnegate in interface IRationalnegate in interface ISignedNumbernegate in class ExprImplpublic INumber numericNumber()
IBigNumbernumericNumber in interface IBigNumberpublic Num numValue()
ISignedNumberNum object.numValue in interface ISignedNumberpublic ISignedNumber 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.opposite in interface IExpropposite in interface INumberopposite in interface ISignedNumberopposite in class ExprImplIExpr.negative()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 final IFraction pow(long n) throws java.lang.ArithmeticException
public int sign()
sign in interface ISignedNumberpublic IFraction subdiv(IFraction s, FractionSym d)
(this-s)/d.public ISignedNumber subtractFrom(ISignedNumber that)
that signed number from this signed numbersubtractFrom in interface ISignedNumberthat - a signed numberpublic IExpr times(IExpr that)
IExpr 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 double getImaginary()
INumbergetImaginary in interface INumber