Polynomial
class
Polynomial
A polynomial in the form ax^3 + bx^2 + cx + d up to a cubic polynomial.
Source code liberally taken from:
Constructors
constructor
Parameters
-
c0 : numberThe constant coefficient
Properties
c0
readonly
public
c0
:
number
c1
readonly
public
c1
:
number
c2
readonly
public
c2
:
number
c3
readonly
public
c3
:
number
Accessors
degree
public
get
degree
():
number
The degree of the polynomial
Methods
differentiate
public
differentiate
n
:
number
=
1
:
Polynomial
Return the nth derivative of the polynomial.
Parameters
-
n : number = 1The number of times to differentiate the polynomial.
eval
public
eval
t
:
number
:
number
public
eval
t
:
number
derivative
:
number
:
number
Evaluate the polynomial at the given value t.
Parameters
-
t : numberThe value to sample at
localExtrema
public
localExtrema
():
number
[]
Calculate the local extrema of the polynomial.
localExtrema01
public
localExtrema01
():
number
[]
Calculate the local extrema of the polynomial in the unit interval.
outputRange01
public
outputRange01
():
number
[]
Return the output value range within the unit interval.
roots
public
roots
():
number
[]
Calculate the roots (values where this polynomial = 0).
Depending on the degree of the polynomial, returns between 0 and 3 results.
split
public
split
u
:
number
:
Polynomial
Polynomial
Split the polynomial into two polynomials of the same overall shape.
Parameters
-
u : numberThe point at which to split the polynomial.
constant
static
public
constant
c0
:
number
:
Polynomial
Constructs a constant polynomial
Parameters
-
c0 : numberThe constant coefficient
cubic
Constructs a cubic polynomial
Parameters
-
c0 : numberThe constant coefficient
-
c1 : numberThe linear coefficient
-
c2 : numberThe quadratic coefficient
-
c3 : numberThe cubic coefficient
linear
Constructs a linear polynomial
Parameters
quadratic
Constructs a quadratic polynomial