Algebraic class abstract
Abstract class representing an algebraic equation, also know as polynomial equation, which has a single variable with a maximum degree.
The coefficients of the algebraic equations can be real numbers or complex numbers. These are examples of an algebraic equations of third degree:
- x3 + 5x + 2 = 0
- 2x3 + (6+i)x + 8i = 0
This class stores the list of coefficients starting from the one with the highest degree.
Constructors
-
Algebraic(List<
Complex> coefficients) - Creates a new algebraic equation by taking the coefficients of the polynomial starting from the one with the highest degree.
-
Algebraic.from(List<
Complex> coefficients) -
Returns an Algebraic instance according with the number of
coefficients
passed. In particular:factory -
Algebraic.fromReal(List<
double> coefficients) -
Returns an Algebraic instance according with the number of
coefficients
passed. In particular:factory -
Algebraic.realEquation(List<
double> coefficients) - Creates a new algebraic equation by taking the coefficients of the polynomial starting from the one with the highest degree.
Properties
-
coefficients
↔ List<
Complex> -
An unmodifiable list with the coefficients of the polynomial.
latefinal
- degree → num
-
The degree of the polynomial.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isRealEquation → bool
-
Determines whether the polynomial is real or not.
no setter
- isValid → bool
-
A polynomial equation is valid if the coefficient associated to the
variable of highest degree is different from zero. In other words, the
polynomial is valid if
a
is different from zero.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
coefficient(
int degree) → Complex? -
Returns the coefficient of the polynomial whose degree is
degree
. For example: -
derivative(
) → Algebraic - The derivative of the polynomial.
-
discriminant(
) → Complex - The discriminant of the algebraic equation if it exists.
-
evaluateIntegralOn(
double lower, double upper) → Complex -
Integrates the polynomial between
lower
andupper
and computes the result. -
evaluateOn(
Complex x) → Complex -
Evaluates the polynomial on the specified complex number
x
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
realEvaluateOn(
double x) → Complex -
Evaluates the polynomial on the specified real number
x
. -
solutions(
) → List< Complex> - Calculates the roots (the solutions) of the equation.
-
toString(
) → String -
A string representation of this object.
override
-
toStringWithFractions(
) → String - Returns a string representation of the polynomial where the coefficients are converted into their fractional representation.
Operators
-
operator *(
Algebraic other) → Algebraic - The product of two polynomials is performed by multiplying the corresponding coefficients of the polynomials. The degrees of the two polynomials don't need to be the same so you can multiply a Constant with a Laguerre for example.
-
operator +(
Algebraic other) → Algebraic - The addition of two polynomials is performed by adding the corresponding coefficients. The degrees of the two polynomials don't need to be the same so you can sum a Cubic with a Linear for example.
-
operator -(
Algebraic other) → Algebraic - The difference of two polynomials is performed by subtracting the corresponding coefficients. The degrees of the two polynomials don't need to be the same so you can subtract a Quadratic and a Quartic for example.
-
operator /(
Algebraic other) → AlgebraicDivision - This operator divides a polynomial by another polynomial of the same or lower degree.
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
int index) → Complex -
Returns the coefficient of the polynomial at the given
index
position. For example: -
operator unary-(
) → Algebraic - The 'negation' operator changes the sign of every coefficient of the polynomial. For example: