public class IntegerSym extends AbstractIntegerSym
int
valueAbstractIntegerSym
,
BigIntegerSym
,
Serialized FormBI_MINUS_ONE
PRIME_CERTAINTY
ASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID
Constructor and Description |
---|
IntegerSym()
do not use directly, needed for serialization/deserialization
|
IntegerSym(int value)
do not use directly, needed for serialization/deserialization
|
Modifier and Type | Method and Description |
---|---|
IInteger |
add(IInteger that) |
IRational |
add(IRational parm1) |
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. |
int |
complexSign()
Gets the signum value of a complex number
|
IInteger |
div(IInteger that) |
IInteger[] |
divideAndRemainder(IInteger that)
Returns an array of two IIntegers containing (this / that) followed by
(this % that).
|
ISignedNumber |
divideBy(ISignedNumber that)
Divide
this signed number by that signed number. |
IAST |
divisors()
Return the divisors of this integer number.
|
double |
doubleValue() |
IInteger |
eabs()
Get the absolute value for a given number
|
IExpr[] |
egcd(IExpr that)
IntegerSym extended greatest common divisor.
|
boolean |
equals(java.lang.Object obj)
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? |
IExpr |
exponent(IInteger base)
Get the highest exponent of
base that divides
this |
IAST |
factorInteger()
Return the factors paired with their exponents for integer and fractional
numbers.
|
IAST |
factorize(IAST result)
Get all prime factors of this integer
|
IInteger |
gcd(IInteger that)
Returns the greatest common divisor of this large integer and the one
specified.
|
java.math.BigInteger |
getBigDenominator()
Returns the denominator of this fraction.
|
java.math.BigInteger |
getBigNumerator()
Returns the numerator of this Rational.
|
IInteger |
getDenominator()
Returns the denominator of this fraction.
|
org.apache.commons.math4.fraction.BigFraction |
getFraction()
Returns this number as
BigFraction number. |
ISignedNumber |
getIm()
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
|
int |
hashCode()
Hashcode of this Element.
|
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.
|
int |
intValue()
Converts this large integer to
int ; unlike ISignedNumber.toInt()
this method raises no exception, if this integer cannot be represented by
an int type. |
ISignedNumber |
inverse()
Returns the multiplicative inverse of this object.
|
boolean |
isEven() |
boolean |
isGreaterThan(ISignedNumber obj)
Test if
this signed number is greater than that signed number.. |
boolean |
isLargerThan(java.math.BigInteger that) |
boolean |
isLessThan(ISignedNumber obj)
Test if
this signed number is less than that signed number.. |
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 |
isOdd() |
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 |
isProbablePrime() |
boolean |
isProbablePrime(int certainty) |
boolean |
isRationalValue(IRational value)
Test if this expression equals
value in symbolic or numeric
mode. |
boolean |
isZero()
Test if this expression equals
0 in symbolic or numeric
mode. |
long |
longValue() |
IInteger |
mod(IInteger that) |
IInteger |
modInverse(IInteger that) |
IInteger |
modPow(IInteger exp,
IInteger that) |
IInteger |
moebiusMu() |
IInteger |
multiply(IInteger that)
Multiply this integer with value
|
IRational |
multiply(IRational parm1) |
IntegerSym |
negate()
Negate 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 |
nthRoot(int n)
Returns the nth-root of this integer.
|
IInteger[] |
nthRootSplit(int n)
Split this integer into the nth-root (with prime factors less equal 1021)
and the "rest-factor", so that
this== (nth-root)^n + rest |
INumber |
numericNumber()
Create a numeric number from this exact "symbolic" number.
|
Num |
numValue()
Get a Java double number wrapped into a
Num object. |
IInteger |
quotient(IInteger that) |
void |
readExternal(java.io.ObjectInput objectInput) |
IExpr |
remainder(IExpr that)
Remainder after division of this by S.
|
IInteger |
remainder(IInteger that) |
IInteger |
round()
Returns the closest
IInteger to the argument. |
IInteger |
shiftLeft(int n) |
IInteger |
shiftRight(int n) |
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).
|
IInteger |
sqrt()
Returns the integer square root of this integer.
|
IInteger |
subtract(IInteger that) |
IRational |
subtract(IRational parm1) |
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() |
void |
writeExternal(java.io.ObjectOutput objectOutput) |
abs, accept, accept, accept, accept, apcomplexNumValue, apcomplexValue, apfloatNumValue, ceil, ceilFraction, divideBy, eulerPhi, evaluate, floor, floorFraction, gcd, getImaginary, getReal, head, hierarchy, internalFormString, isNumEqualInteger, isNumEqualRational, isNumIntValue, jacobiSymbol, jacobiSymbolF, jacobiSymbolG, lcm, lcm, multiply, opposite, plus, pow, primitiveRoots, subtractFrom, times, toByteArray, valueOf, valueOf, valueOf, valueOf
$div, $minus, $plus, $times, $up, and, apply, apply, asType, conjugate, copy, dec, divide, evalComplex, evalDouble, evalNumber, evalSignedNumber, factory, fullFormString, getAt, inc, leafCount, leaves, minus, mod, multiply, negative, optional, or, power, power, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceRepeated, replaceSlots, signum, subtract, sum, topHead, toScript, toScriptFactory, variables2Slots
clone, 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, 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, isNumeric, isNumericFunction, isNumericMode, 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, variables2Slots
public IntegerSym()
public IntegerSym(int value)
public 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 1public int compareInt(int value)
public int compareTo(IExpr expr)
public ComplexNum complexNumValue()
INumber
ComplexNum
number bject.public int complexSign()
INumber
this == 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 IInteger[] divideAndRemainder(IInteger that)
public ISignedNumber divideBy(ISignedNumber that)
ISignedNumber
this
signed number by that
signed number.that
- a signed numberpublic IAST divisors()
divisors(24) ==> {1,2,3,4,6,8,12,24}
public double doubleValue()
public IInteger eabs()
public boolean equals(java.lang.Object obj)
edu.jas.structure.Element
equals
in interface edu.jas.structure.Element<IExpr>
equals
in class java.lang.Object
public final boolean equalsFraction(int numerator, int denominator)
IRational
numerator/denominator
number.
GCD(numerator, /denominator)
should be 1;numerator
- the numeratordenominator
- the denominatorpublic boolean equalsInt(int value)
INumber
int
number?value
- the integer numberpublic IExpr exponent(IInteger base)
base
that divides
this
base
- an integer greater than 1public IAST factorInteger()
factorInteger(-4) ==> {{-1,1},{2,2}}
public IInteger gcd(IInteger that)
public java.math.BigInteger getBigDenominator()
public java.math.BigInteger getBigNumerator()
public IInteger getDenominator()
public org.apache.commons.math4.fraction.BigFraction getFraction()
BigFraction
number.this
number s big fraction.public ISignedNumber getIm()
public IInteger getNumerator()
public ISignedNumber getRe()
public final int hashCode()
hashCode
in interface edu.jas.structure.Element<IExpr>
hashCode
in class java.lang.Object
public java.lang.String internalJavaString(boolean symbolsAsFactoryMethod, int depth, boolean useOperators)
ExprImpl
internalJavaString
in interface IExpr
internalJavaString
in class ExprImpl
symbolsAsFactoryMethod
- 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)
ExprImpl
internalScalaString
in interface IExpr
internalScalaString
in class ExprImpl
symbolsAsFactoryMethod
- 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 int intValue()
IInteger
int
; unlike ISignedNumber.toInt()
this method raises no exception, if this integer cannot be represented by
an int
type.int
.public ISignedNumber inverse()
ExprImpl
this.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.inverse
in interface edu.jas.structure.MonoidElem<IExpr>
inverse
in interface IExpr
inverse
in interface ISignedNumber
inverse
in class AbstractIntegerSym
public boolean isEven()
public boolean isGreaterThan(ISignedNumber obj)
ISignedNumber
this
signed number is greater than
that signed number..this > that
public boolean isLargerThan(java.math.BigInteger that)
that
- public boolean isLessThan(ISignedNumber obj)
ISignedNumber
this
signed number is less than
that signed number..this < that
public boolean isMinusOne()
IExpr
-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 isOdd()
public boolean isOne()
IExpr
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 isProbablePrime()
public boolean isProbablePrime(int certainty)
public boolean isRationalValue(IRational value)
value
in symbolic or numeric
mode.public boolean isZero()
IExpr
0
in symbolic or numeric
mode.public long longValue()
public IInteger moebiusMu()
public IInteger multiply(IInteger that)
IInteger
that
- public IntegerSym negate()
ExprImpl
negate
in interface edu.jas.structure.AbelianGroupElem<IExpr>
negate
in interface org.apache.commons.math4.FieldElement<IExpr>
negate
in interface IInteger
negate
in interface IRational
negate
in interface ISignedNumber
negate
in class AbstractIntegerSym
public INumber normalize()
IRational
public IInteger nthRoot(int n) throws java.lang.ArithmeticException
k such as k^n <= this < (k + 1)^n
java.lang.IllegalArgumentException
- if this < 0
java.lang.ArithmeticException
- if this integer is negative and n is even.public IInteger[] nthRootSplit(int n) throws java.lang.ArithmeticException
this== (nth-root)^n + rest
{nth-root, rest}
java.lang.ArithmeticException
public final INumber numericNumber()
IBigNumber
public Num numValue()
ISignedNumber
Num
object.public void readExternal(java.io.ObjectInput objectInput) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public IExpr remainder(IExpr that)
edu.jas.structure.MonoidElem
public IInteger round()
ISignedNumber
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 IInteger shiftLeft(int n)
public IInteger shiftRight(int n)
public int sign()
ISignedNumber
public IInteger sqrt() throws java.lang.ArithmeticException
k such as k^2 <= this < (k + 1)^2
java.lang.ArithmeticException
- if this integer is negative.public IRational subtract(IRational parm1)
subtract
in interface IRational
subtract
in class AbstractIntegerSym
public 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
public void writeExternal(java.io.ObjectOutput objectOutput) throws java.io.IOException
java.io.IOException