Num
org.matheclipse.core.expression

Class Num

    • Method Detail

      • hierarchy

        public int hierarchy()
        Description copied from interface: IExpr
        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
      • isNumIntValue

        public boolean isNumIntValue()
        Check if this expression represents an int value. The value of an INum object can be an int value.
        Specified by:
        isNumIntValue in interface IExpr
        Specified by:
        isNumIntValue in interface INum
        Overrides:
        isNumIntValue in class ExprImpl
        Returns:
      • equalsInt

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

        public static double valueOf(String chars)
        Parameters:
        chars -
        Returns:
      • valueOf

        public static Num valueOf(double doubleValue)
        Parameters:
        doubleValue -
        Returns:
      • eabs

        public Num eabs()
        Description copied from interface: INumber
        Get the absolute value for a given number
        Specified by:
        eabs in interface INumber
        Returns:
      • plus

        public double plus(double that)
        Parameters:
        that -
        Returns:
      • compareTo

        public int compareTo(double that)
        Parameters:
        that -
        Returns:
      • divide

        public double divide(double that)
        Parameters:
        that -
        Returns:
      • equals

        public boolean equals(Object arg0)
        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.
      • isSame

        public boolean isSame(IExpr expression,             double epsilon)
        Description copied from interface: IExpr
        Test if this expression equals the given expression. If the compared expressions are of the same numeric type, they are equal to a given EPSILON
        Specified by:
        isSame in interface IExpr
        Overrides:
        isSame in class ExprImpl
      • exp

        public double exp()
      • hashCode

        public final 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.
      • intValue

        public int intValue()
        Description copied from interface: INum
        Returns the value of this number as an int (by simply casting to type int).
        Specified by:
        intValue in interface INum
        Returns:
      • 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.
      • isInfinite

        public boolean isInfinite()
        Returns:
      • isNaN

        public boolean isNaN()
        Returns:
      • log

        public double log()
        Returns:
      • longValue

        public long longValue()
        Returns:
      • times

        public double times(double that)
        Parameters:
        that -
        Returns:
      • times

        public IExpr times(IExpr that)
        Description copied from interface: IExpr
        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.
      • pow

        public double pow(double that)
        Parameters:
        that -
        Returns:
      • pow

        public double pow(int exp)
        Parameters:
        exp -
        Returns:
      • sqrt

        public double sqrt()
        Returns:
      • minus

        public double minus(double that)
        Parameters:
        that -
        Returns:
      • getRealPart

        public double getRealPart()
        Specified by:
        getRealPart in interface INum
        Returns:
      • isZero

        public boolean isZero()
        Description copied from interface: IExpr
        Test if this expression equals 0 in symbolic or numeric mode.
        Specified by:
        isZero in interface IExpr
        Specified by:
        isZero in interface ISignedNumber
        Overrides:
        isZero in class ExprImpl
      • isOne

        public boolean isOne()
        Description copied from interface: IExpr
        Test if this expression equals 1 in symbolic or numeric mode.
        Specified by:
        isOne in interface IExpr
        Overrides:
        isOne in class ExprImpl
      • isMinusOne

        public boolean isMinusOne()
        Description copied from interface: IExpr
        Test if this expression equals -1 in symbolic or numeric mode.
        Specified by:
        isMinusOne in interface IExpr
        Overrides:
        isMinusOne in class ExprImpl
      • round

        public IInteger round()
        Description copied from interface: ISignedNumber
        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.
      • sign

        public int sign()
        Description copied from interface: ISignedNumber
        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.
      • 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.1 © jWork.ORG