Algebraic class abstract base

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 coefficients list starting from the one with the highest degree.

Implementers

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)
Creates an Algebraic subtype according with the length of the coefficients list. In particular:
factory
Algebraic.fromReal(List<double> coefficients)
Creates an Algebraic subtype according with the length of the coefficients list. 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>
The list with the polynomial coefficients.
final
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
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 polynomial discriminant, if it exists.
evaluateIntegralOn(double lower, double upper) Complex
Evaluates the integral of the the polynomial between lower and upper.
evaluateOn(Complex x) Complex
Evaluates the polynomial on the given x value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
realEvaluateOn(double x) Complex
Evaluates the polynomial on the given decimal x value.
solutions() List<Complex>
Finds the roots (the solutions) of the associated P(x) = 0 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.
operator +(Algebraic other) Algebraic
The sum of two polynomials is performed by adding the corresponding coefficients.
operator -(Algebraic other) Algebraic
The difference of two polynomials is performed by subtracting the corresponding coefficients.
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: