public class FractionSym extends AbstractFractionSym
org.apache.commons.math4.fraction.Fraction methods.AbstractFractionSym,
BigFractionSym,
Serialized FormMONE, ONE, ZEROASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID| Modifier and Type | Method and Description |
|---|---|
IFraction |
abs()
Compute the absolute of this rational.
|
IFraction |
add(IFraction other)
Return a new rational representing
this + other. |
IRational |
add(IRational parm1) |
IInteger |
ceil() |
IFraction |
ceilFraction()
Return a new rational representing the smallest integral rational not
smaller than
this. |
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 |
compareInt(int value) |
int |
compareTo(IExpr expr)
Compares this expression with the specified expression for order.
|
ComplexNum |
complexNumValue()
Get a
ComplexNum number bject. |
IFraction |
div(IFraction other)
Return a new rational representing
this / other. |
IInteger[] |
divideAndRemainder()
Returns an array of two BigIntegers containing (numerator / denominator)
followed by (numerator % denominator).
|
double |
doubleValue() |
boolean |
equals(java.lang.Object o)
Test if this is equal to b.
|
boolean |
equalsFraction(int numerator,
int denominator)
Check if this number equals the given fraction
numerator/denominator number. |
boolean |
equalsInt(int value)
Check if this number equals the given
int number? |
IInteger |
floor() |
IFraction |
floorFraction()
Return a new rational representing the biggest integral rational not
bigger than
this. |
IFraction |
frac()
Returns the fractional part of the rational, i.e. the number
this.sub(this.floor()).
|
java.lang.String |
fullFormString()
Return the
FullForm() of this expression |
IExpr |
gcd(IExpr that)
Greatest common divisor.
|
IFraction |
gcd(IFraction other)
Compute the gcd of two rationals (this and other).
|
java.math.BigInteger |
getBigDenominator()
Returns the denominator of this fraction.
|
java.math.BigInteger |
getBigNumerator()
Returns the numerator of this fraction.
|
org.apache.commons.math4.fraction.BigFraction |
getFraction()
Returns this number as
BigFraction number. |
org.apache.commons.math4.fraction.BigFraction |
getRational() |
int |
hashCode()
Hashcode of this Element.
|
java.lang.String |
internalFormString(boolean symbolsAsFactoryMethod,
int depth)
Return the internal Java form of this expression.
|
java.lang.String |
internalJavaString(boolean symbolsAsFactoryMethod,
int depth,
boolean useOperators)
Return the internal Java form of this expression.
|
java.lang.String |
internalScalaString(boolean symbolsAsFactoryMethod,
int depth)
Return the internal Scala form of this expression.
|
IFraction |
inverse()
Returns a new rational representing the inverse of
this. |
boolean |
isDefined()
Check whether this rational corresponds to a (finite) rational value.
|
boolean |
isIntegral()
Check whether this rational represents an integral value.
|
boolean |
isMinusOne()
Test if this expression equals
-1 in symbolic or numeric
mode. |
boolean |
isNegative()
Test if this object is a negative signed number.
|
boolean |
isOne()
Test if this expression equals
1 in symbolic or numeric
mode. |
boolean |
isPositive()
Test if this object is a positive signed number.
|
boolean |
isZero()
Test if this expression equals
0 in symbolic or numeric
mode. |
IFraction |
mul(java.math.BigInteger other)
Return a new rational representing
this * other. |
IFraction |
mul(IFraction other)
Return a new rational representing
this * other. |
IRational |
multiply(IRational parm1) |
IFraction |
negate()
Returns a new rational equal to
-this. |
INumber |
normalize()
Return the normalized form of this number (i.e. if the denominator part
equals one, return the numerator part as an integer number).
|
IInteger |
round()
Returns the closest
IInteger to the argument. |
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).
|
int |
toInt()
Converts this number to
int; unlike #intValue this method raises ArithmeticException if this
number cannot be represented by an int type. |
long |
toLong()
Converts this number to
long; unlike #longValue this method raises ArithmeticException if this
number cannot be represented by an long type. |
java.lang.String |
toString() |
accept, accept, accept, accept, addmul, apcomplexNumValue, apcomplexValue, apfloatNumValue, complexSign, divideBy, divideBy, eabs, evaluate, factorInteger, gcd, getDenominator, getIm, getImaginary, getNumerator, getRe, getReal, head, hierarchy, isGreaterThan, isLessThan, isNumEqualRational, isRationalValue, multiply, numericNumber, numValue, opposite, plus, pow, sub, subdiv, subtract, subtractFrom, times, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf$div, $minus, $plus, $times, $up, and, apply, apply, asType, conjugate, copy, dec, divide, egcd, evalComplex, evalDouble, evalNumber, evalSignedNumber, factory, getAt, inc, 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, getAt, getField, ifPresent, inc, 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, isModule, isNegativeInfinity, isNegativeResult, isNonNegativeResult, isNot, isNumber, isNumEqualInteger, isNumeric, isNumericFunction, isNumericMode, isNumIntValue, 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 IFraction abs()
public IFraction add(IFraction other)
this + other.add in interface IFractionadd in class AbstractFractionSymother - Rational to add.this and other.public IInteger ceil()
public IFraction ceilFraction()
this.ceilFraction in interface INumberceilFraction in class AbstractFractionSymthis.public int compareAbsValueToOne()
INumber1 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 1public int compareInt(int value)
public int compareTo(IExpr expr)
IExprpublic ComplexNum complexNumValue()
INumberComplexNum number bject.public IFraction div(IFraction other)
this / other.other - Rational to divide.this and other.public IInteger[] divideAndRemainder()
IFractionpublic double doubleValue()
public boolean equals(java.lang.Object o)
edu.jas.structure.Elementequals in interface edu.jas.structure.Element<IExpr>equals in class java.lang.Objectpublic final boolean equalsFraction(int numerator,
int denominator)
IRationalnumerator/denominator number.
GCD(numerator, /denominator) should be 1;numerator - the numeratordenominator - the denominatorpublic boolean equalsInt(int value)
INumberint number?equalsInt in interface INumberequalsInt in class AbstractFractionSymvalue - the integer numberpublic IInteger floor()
public IFraction floorFraction()
this.floorFraction in interface INumberfloorFraction in class AbstractFractionSymthis.public IFraction frac()
this.public java.lang.String fullFormString()
IExprFullForm() of this expressionfullFormString in interface IExprfullFormString in class ExprImplpublic IExpr gcd(IExpr that)
edu.jas.structure.RingElempublic IFraction gcd(IFraction other)
other - the second rational argument.public java.math.BigInteger getBigDenominator()
IFractionpublic java.math.BigInteger getBigNumerator()
IFractionpublic org.apache.commons.math4.fraction.BigFraction getFraction()
BigFraction number.this number s big fraction.public org.apache.commons.math4.fraction.BigFraction getRational()
public int hashCode()
edu.jas.structure.ElementhashCode in interface edu.jas.structure.Element<IExpr>hashCode in class java.lang.Objectpublic java.lang.String internalFormString(boolean symbolsAsFactoryMethod,
int depth)
ExprImplinternalFormString in interface IExprinternalFormString in class ExprImplsymbolsAsFactoryMethod - if true use the F.symbol() method,
otherwise print the symbol name.depth - the recursion depth of this call. 0 indicates
"recurse without a limit".public java.lang.String internalJavaString(boolean symbolsAsFactoryMethod,
int depth,
boolean useOperators)
ExprImplinternalJavaString in interface IExprinternalJavaString in class ExprImplsymbolsAsFactoryMethod - if true use the F.symbol() method,
otherwise print the symbol name.depth - the recursion depth of this call. 0 indicates
"recurse without a limit".useOperators - use operators instead of function names for representation of
Plus, Times, Power,...public java.lang.String internalScalaString(boolean symbolsAsFactoryMethod,
int depth)
ExprImplinternalScalaString in interface IExprinternalScalaString in class ExprImplsymbolsAsFactoryMethod - if true use the F.symbol() method,
otherwise print the symbol name.depth - the recursion depth of this call. 0 indicates
"recurse without a limit".public IFraction inverse()
this.inverse in interface edu.jas.structure.MonoidElem<IExpr>inverse in interface IExprinverse in interface IFractioninverse in interface ISignedNumberinverse in class AbstractFractionSymthis.public boolean isDefined()
public boolean isIntegral()
isIntegral in class AbstractFractionSymtrue iff value is integral.public boolean isMinusOne()
-1 in symbolic or numeric
mode.public boolean isNegative()
IAST
object the method checks, if it is a numeric constant. If the
IAST object evaluates to a negative numeric expression this
method returns true.true, if this < 0; false
in all other case.public boolean isOne()
1 in symbolic or numeric
mode.public boolean isPositive()
IAST
object the method checks, if it is a numeric constant. If the
IAST object evaluates to a positive numeric expression this
method returns true.true, if this > 0; false
in all other case.public boolean isZero()
0 in symbolic or numeric
mode.public IFraction mul(java.math.BigInteger other)
this * other.other - big integer to multiply.this and other.public IFraction mul(IFraction other)
this * other.mul in interface IFractionmul in class AbstractFractionSymother - Rational to multiply.this and other.public IFraction negate()
-this.negate 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 AbstractFractionSym-this.public INumber normalize()
public IInteger round()
IInteger to the argument. The result is rounded to an integer by adding 1/2 and taking the
floor of the result.ArithmeticException if a numeric value cannot be represented by an long type.public int sign()
sign in interface ISignedNumbersign in class AbstractFractionSympublic int toInt()
throws java.lang.ArithmeticException
int; unlike #intValue this method raises ArithmeticException if this
number cannot be represented by an int type.int.java.lang.ArithmeticException - if conversion to int is not possible.public long toLong()
throws java.lang.ArithmeticException
long; unlike #longValue this method raises ArithmeticException if this
number cannot be represented by an long type.long.java.lang.ArithmeticException - if conversion to int is not possible.public java.lang.String toString()
toString in class java.lang.Object