Documentation of 'org.spaceroots.mantissa.algebra.Polynomial' Java class
Polynomial
org.spaceroots.mantissa.algebra

Class Polynomial

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    Polynomial.Double, Polynomial.Rational


    public abstract class Polynomial
    extends java.lang.Object
    implements java.io.Serializable
    This class implements polynomials with one unknown.

    This is an abstract class that only declares general methods but does not hold the coefficients by themselves. Specific subclasses are used to handle exact rational coefficients or approximate real coefficients. This design is taken from the various java.awt.geom classes (Point2D, Rectangle2D ...)

    The methods implemented deal mainly with the polynomials algebra (addition, multiplication ...) but the analysis aspects are also considered (value of the polynom for a given unknown, derivative).

    Instances of this class are immutable.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  Polynomial.DivisionResult
      This class stores the result of the euclidian division of two polynomials.
      static class  Polynomial.Double
      This class implements polynomials with one unknown and real coefficients.
      static class  Polynomial.Rational
      This class implements polynomials with one unknown and rational coefficients.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Polynomial() 
    • Constructor Detail

      • Polynomial

        public Polynomial()
    • Method Detail

      • isZero

        public abstract boolean isZero()
        Check if the instance is the null polynomial.
        Returns:
        true if the polynomial is null
      • isOne

        public abstract boolean isOne()
        Check if the instance is the constant unit polynomial.
        Returns:
        true if the polynomial is the constant unit polynomial
      • isIdentity

        public abstract boolean isIdentity()
        Check if the instance is the identity polynomial.
        Returns:
        true if the polynomial is the identity polynomial
      • getDegree

        public abstract int getDegree()
        Get the polynomial degree.
        Returns:
        degree
      • negate

        public abstract Polynomial negate()
        Negate the instance.
        Returns:
        a new polynomial
      • multiply

        public abstract Polynomial multiply(RationalNumber r)
        Multiply the instance by a constant.
        Parameters:
        r - constant to multiply by
        Returns:
        a new polynomial
      • multiply

        public abstract Polynomial multiply(long l)
        Multiply the instance by a constant.
        Parameters:
        l - constant to multiply by
        Returns:
        a new Polynomial
      • multiply

        public Polynomial multiply(java.math.BigInteger i)
        Multiply the instance by a constant.
        Parameters:
        i - constant to multiply by
        Returns:
        a new Polynomial
      • divide

        public Polynomial divide(long l)
        Divide the instance by a constant.
        Parameters:
        l - constant to multiply by
        Returns:
        a new polynomial
        Throws:
        java.lang.ArithmeticException - if the constant is zero
      • divide

        public Polynomial divide(RationalNumber r)
        Divide the instance by a constant.
        Parameters:
        r - constant to multiply by
        Returns:
        a new polynomial
        Throws:
        java.lang.ArithmeticException - if the constant is zero
      • divide

        public Polynomial divide(java.math.BigInteger i)
        Divide the instance by a constant.
        Parameters:
        i - constant to multiply by
        Returns:
        a new polynomial
        Throws:
        java.lang.ArithmeticException - if the constant is zero
      • valueAt

        public abstract double valueAt(double x)
        Get the value of the polynomial for a specified unknown.
        Parameters:
        x - value of the unknown
        Returns:
        value of the polynomial
      • getDerivative

        public abstract Polynomial getDerivative()
        Get the derivative of the instance with respect to the unknown. The derivative of a n degree polynomial is a n-1 degree polynomial of the same type.
        Returns:
        a new polynomial which is the derivative of the instance

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.