Packages

case class Poly(c: VectorD, x: String = "x") extends Product with Serializable

The Poly class provides operations on univariate polynomials.

Poly (2, 3) => 3 x + 2

Note, reverse order of coefficients, i.e., coefficients for smallest terms first.

c

the coefficients of the polynomial

x

the variable/indeterminate of the polynomial

See also

MPoly' for multivariate polynomials.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Poly
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Poly(c: VectorD, x: String = "x")

    c

    the coefficients of the polynomial

    x

    the variable/indeterminate of the polynomial

Value Members

  1. def *(q: Poly): Poly

    Add 'this' polynomial and the 'q' polynomial.

    Add 'this' polynomial and the 'q' polynomial.

    q

    the other polynomial

  2. def +(q: Poly): Poly

    Add 'this' polynomial and the 'q' polynomial.

    Add 'this' polynomial and the 'q' polynomial.

    q

    the other polynomial

  3. def -(q: Poly): Poly

    Subtract the 'q' polynomial from 'this' polynomial.

    Subtract the 'q' polynomial from 'this' polynomial.

    q

    the other polynomial

  4. def apply(x: Double): Double

    Apply/evaluate the polynomial at 'x'.

    Apply/evaluate the polynomial at 'x'.

    x

    the value of the variable

  5. val c: VectorD
  6. val deg: Int
  7. def derivative: Poly

    Take the derivative of 'this' polynomial, returning the result as a polynomial.

  8. def integrate(on: Interval): Double

    Integrate 'this' polynomial on the interval 'on', returning its value as a double.

    Integrate 'this' polynomial on the interval 'on', returning its value as a double.

    on

    the interval of integration

  9. def integrate: Poly

    Integrate 'this' polynomial, returning the result as a polynomial.

    Integrate 'this' polynomial, returning the result as a polynomial. Note, the arbitrary constant 'c' for the indefinite integral is set to 1.

  10. def parse(str: String): Poly

    Parse a readable/LaTeX-compatible string to create a polynomial, using a PEG parser.

    Parse a readable/LaTeX-compatible string to create a polynomial, using a PEG parser.

    str

    the string to parse, e.g., "2.0 x3 + 3.0 x2 + 4.0 x + 5.0"

    See also

    https://github.com/sirthias/parboiled2

  11. def parse2(str: String): Poly

    Parse a compilable Scala expression string to create a polynomial, using a PEG parser.

    Parse a compilable Scala expression string to create a polynomial, using a PEG parser.

    str

    the string to parse, e.g., "2.0*x~3 + 3.0*x~2 + 4.0*x + 5.0"

    See also

    https://github.com/sirthias/parboiled2

  12. def toString(): String

    Convert the polynomial to a readable/LaTeX-compatible string.

    Convert the polynomial to a readable/LaTeX-compatible string.

    Definition Classes
    Poly → AnyRef → Any
  13. def toString2: String

    Convert the polynomial to an compilable Scala expression string.

  14. def trim: Poly

    Trim away trailing zero coefficients (i.e., those on highest order terms), returning the resulting polynomial of possibly lower degree.

  15. val x: String
  16. def : Poly
  17. def (on: Interval): Double
  18. def : Poly