Polynomial class
A class representing a Polynomial of arbitrary degree.
- Inheritance
-
- Object
- Expression
- Polynomial
- Implementers
- Available extensions
Constructors
- Polynomial(List coefficients, {Variable? variable})
- Polynomial.fromString(String source, {Variable? variable})
-
Creates a Polynomial instance from a string representation of a Polynomial.
factory
Properties
-
coefficients
→ List<
Expression> -
final
- degree → int
-
Get the degree of the Polynomial
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- polynomial ↔ Polynomial
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- variable → Variable
-
final
Methods
-
coefficient(
int degree) → dynamic -
Returns the coefficient of the Polynomial whose degree is
degree. -
depth(
) → int -
Calculate the depth of the expression tree.
override
-
differentiate(
[Variable? v]) → Expression -
Returns the derivative of the quadratic equation.
override
-
discriminant(
) → dynamic -
evaluate(
[dynamic x]) → dynamic -
Evaluates the Polynomial for a given x value.
override
-
expand(
) → Expression -
Expands the expression, if applicable, and returns a new expanded expression.
override
-
factorize(
) → List< Polynomial> - Returns a list of polynomial factors derived from the complex roots of a polynomial.
-
factorizeString(
) → String - Returns a list of string polynomial factors derived from the complex roots of a polynomial.
-
gcd(
Polynomial other) → Polynomial - Calculates the Greatest Common Divisor of two polynomials.
-
getVariables(
) → Set< Variable> -
Retrieves the base variables present in the expression, effectively
decomposing composite variables into their constituent parts.
For instance, for an expression containing
x^2, it returnsx, and forx*y, it returns bothxandy.inherited -
getVariableTerms(
) → Set< Variable> -
Retrieves all variables present in the expression, including composite
variables like
x^2orx*y.override -
integrate(
[dynamic start, dynamic end]) → Expression -
Returns the integral of the Polynomial equation from 0 to x.
override
-
isIndeterminate(
dynamic x) → bool -
override
-
isInfinity(
dynamic x) → bool -
Simplified. Check if the evaluation at x is infinite.
override
-
isPoly(
[bool strict = false]) → bool -
Checks if the expression is a polynomial.
override
-
lcm(
Polynomial other) → Polynomial - Calculates the Least Common Multiple of two polynomials.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
roots(
) → List -
simplify(
) → Polynomial -
Simplify the Polynomial using factoring by grouping and difference of squares.
This is a placeholder and should be replaced with actual implementation.
Return a new simplified Polynomial
override
-
simplifyBasic(
) → Expression -
Performs basic simplification (arithmetic, combining like terms).
inherited
-
size(
) → int -
Compute the size of the expression based on the number of nodes in its tree.
override
-
substitute(
Expression oldExpr, Expression newExpr) → Expression -
Replace a sub-expression or a variable with another expression.
override
-
toString(
[bool useUnicode = true]) → String -
Returns the string representation of the expression.
override
Operators
-
operator %(
dynamic other) → Expression -
Modulo operator. Creates a Modulo expression.
override
-
operator *(
dynamic other) → Expression -
Multiply operator. Creates a Multiply expression.
override
-
operator +(
dynamic other) → Expression -
Add operator. Creates an Add expression.
override
-
operator -(
dynamic other) → Expression -
Subtract operator. Creates a Subtract expression.
override
-
operator /(
dynamic other) → Expression -
Divide operator. Creates a Divide expression.
override
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
int index) → dynamic -
Returns the coefficient of the Polynomial at the given
indexposition. For example: -
operator ^(
dynamic other) → Expression -
Power operator. Creates a Pow expression.
inherited
Static Methods
-
fromList(
List coefficientList, {Variable? variable}) → Polynomial - Constructs a Polynomial from a list of coefficients.
-
isPolynomial(
String expression, {String varName = 'x'}) → bool - Check if an expression is a polynomial