FractionSym
org.matheclipse.core.expression

Class FractionSym

    • Method Detail

      • valueOf

        public static FractionSym valueOf(long numerator,                  long denominator)
      • valueOf

        public static FractionSym valueOf(double value)
      • equalsInt

        public boolean equalsInt(int i)
        Is this number equal an integer number?
        Specified by:
        equalsInt in interface INumber
        Returns:
      • getFraction

        public BigFraction getFraction()
        Returns this number as BigFraction number.
        Specified by:
        getFraction in interface IRational
        Returns:
        this number s big fraction.
      • getDenominator

        public IInteger getDenominator()
        Returns the denominator of this fraction.
        Specified by:
        getDenominator in interface IRational
        Returns:
        denominator
      • getNumerator

        public IInteger getNumerator()
        Returns the numerator of this Rational.
        Specified by:
        getNumerator in interface IRational
        Returns:
        numerator
      • hierarchy

        public int hierarchy()
        A unique integer ID for the implementation of this expression
        Specified by:
        hierarchy in interface IExpr
        Returns:
        a unique integer id for the implementation of this expression
      • eabs

        public FractionSym eabs()
        Get the absolute value for a given number
        Specified by:
        eabs in interface INumber
        Returns:
      • equals

        public boolean equals(Object obj)
        Description copied from interface: Element
        Test if this is equal to b.
        Specified by:
        equals in interface Element<IExpr>
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to b, else false.
      • evaluate

        public IExpr evaluate(EvalEngine engine)
        Evaluate an expression
        Specified by:
        evaluate in interface IExpr
        Overrides:
        evaluate in class ExprImpl
        Parameters:
        engine - the evaluation engine
        Returns:
        the evaluated Object or null if the evaluation is not possible (i.e. the evaluation doesn\'t change the object).
      • numericNumber

        public final INumber numericNumber()
        Description copied from interface: IBigNumber
        Create a numeric number from this exact "symbolic" number.
        Specified by:
        numericNumber in interface IBigNumber
        Returns:
      • normalize

        public INumber normalize()
        Description copied from interface: IFraction
        Return the normalized form of this number (i.e. if the denominator part equals one, return the numerator part as an integer number).
        Specified by:
        normalize in interface IFraction
        Returns:
      • getDividend

        public BigInteger getDividend()
        Returns:
      • getDivisor

        public BigInteger getDivisor()
        Returns:
      • hashCode

        public int hashCode()
        Description copied from interface: Element
        Hashcode of this Element.
        Specified by:
        hashCode in interface Element<IExpr>
        Overrides:
        hashCode in class Object
        Returns:
        the hashCode.
      • longValue

        public long longValue()
        Returns:
      • pow

        public IFraction pow(int exp)
        Returns this number raised at the specified positive exponent.
        Specified by:
        pow in interface IFraction
        Parameters:
        exp - the positive exponent.
        Returns:
        thisexp
        Throws:
        IllegalArgumentException - if exp <= 0
      • times

        public IExpr times(IExpr that)
        Returns the product of this object with the one specified.
        Specified by:
        times in interface IExpr
        Overrides:
        times in class ExprImpl
        Parameters:
        that - the object multiplier.
        Returns:
        this \xc2\xb7 that.
      • internalFormString

        public String internalFormString(boolean symbolsAsFactoryMethod,                        int depth)
        Return the internal Java form of this expression.
        Specified by:
        internalFormString in interface IExpr
        Overrides:
        internalFormString in class ExprImpl
        Parameters:
        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".
      • toInt

        public int toInt()          throws ArithmeticException
        Converts this number to int; unlike #intValue this method raises ArithmeticException if this number cannot be represented by an int type.
        Specified by:
        toInt in interface ISignedNumber
        Returns:
        the numeric value represented by this integer after conversion to type int.
        Throws:
        ArithmeticException - if conversion to int is not possible.
      • toLong

        public long toLong()            throws ArithmeticException
        Converts this number to long; unlike #longValue this method raises ArithmeticException if this number cannot be represented by an long type.
        Specified by:
        toLong in interface ISignedNumber
        Returns:
        the numeric value represented by this integer after conversion to type long.
        Throws:
        ArithmeticException - if conversion to int is not possible.
      • sign

        public 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).
        Specified by:
        sign in interface ISignedNumber
        Returns:
        -1 if this is a negative number;
        0 if this is a zero;
        -1 if this is a negative number;
      • complexSign

        public int complexSign()
        Gets the signum value of a complex number
        Specified by:
        complexSign in interface INumber
        Returns:
        0 for 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 )
      • ceil

        public IInteger ceil()
        Returns the smallest (closest to negative infinity) IInteger 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.
        Specified by:
        ceil in interface ISignedNumber
        Returns:
        the smallest (closest to negative infinity) IInteger value that is not less than this and is equal to a mathematical integer.
      • floor

        public IInteger floor()
        Returns the largest (closest to positive infinity) IInteger value that is not greater than this and is equal to a mathematical integer.
        This method raises ArithmeticException if a numeric value cannot be represented by an long type.
        Specified by:
        floor in interface ISignedNumber
        Returns:
        the largest (closest to positive infinity) IInteger value that is not greater than this and is equal to a mathematical integer.
      • round

        public IInteger round()
        Returns the closest IInteger to the argument. The result is rounded to an integer by adding 1/2 and taking the floor of the result.
        This method raises ArithmeticException if a numeric value cannot be represented by an long type.
        Specified by:
        round in interface ISignedNumber
        Returns:
        the closest integer to the argument.
      • 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.
        Specified by:
        compareTo in interface Element<IExpr>
        Specified by:
        compareTo in interface Comparable<IExpr>
        Specified by:
        compareTo in interface IExpr
        Returns:
        0 if this is equal to b, -1 if this is less then b, else +1.
      • head

        public ISymbol head()
        Description copied from interface: IExpr
        If this object is an instance of IAST get the first element (offset 0) of the IAST list (i.e. get(0) ).
        Specified by:
        head in interface IExpr
        Specified by:
        head in class ExprImpl
        Returns:
        the head of the expression, which must not be null.
      • accept

        public <T> T accept(IVisitor<T> visitor)
        Accept a visitor with return type T
        Specified by:
        accept in interface IExpr
      • accept

        public boolean accept(IVisitorBoolean visitor)
        Accept a visitor with return type boolean
        Specified by:
        accept in interface IExpr
      • accept

        public int accept(IVisitorInt visitor)
        Accept a visitor with return type int
        Specified by:
        accept in interface IExpr
        Returns:
      • getIm

        public ISignedNumber getIm()
        Returns the imaginary part of a complex number
        Specified by:
        getIm in interface INumber
        Returns:
        real part
      • getRe

        public ISignedNumber getRe()
        Returns the real part of a complex number
        Specified by:
        getRe in interface INumber
        Returns:
        real part

SCaVis 2.2 © jWork.ORG