-
Notifications
You must be signed in to change notification settings - Fork 1
Polynomials
The polynomial class allows for storage and manipulation of polynomials.
A polynomial is initialised with polynomial.Polynomial(inputPolynomial, dictInput=False)
where inputPolynomial
is either a string of arbitrary size in form ax^n + bx + c
(the terms can have any exponent and be in any order) or a dictionary in form {exponent1: coefficient1, exponent2: coefficient2}
.
Polynomial
support the use of the binary arithmetic operators +
, -
, +=
, and -=
to add and subtract the polynomials. Polynomial.differentiate()
and Polynomial.integrate()
return the differentiated and integrated forms of the polynomial respectively. Polynomial.integrateDefinite(upper, lower)
returns the definite integral of the polynomial between upper
and lower
. Polynomial.output(readable=False)
returns either the polynomial in the form ax^n + bx + c
or the dictionary form of the polynomial, depending on the value of readable
.