Linear class
Concrete implementation of Polynomial that represents a first degree polynomial equation in the form ax + b = 0.
This equation has exactly 1 solution, which can be real or complex.
- Inheritance
-
- Object
- Expression
- Polynomial
- Linear
- Available extensions
Constructors
- Linear.new({Number a = Integer.one, Number b = Integer.zero})
-
Linear.fromList(List<
Number> coefficients) - Linear.num({num a = 1, num b = 0})
Properties
- a → Number
-
The first coefficient of the equation in the form f(x) = ab + b.
no setter
- b → Number
-
The second coefficient of the equation in the form f(x) = ab + b.
no setter
-
coefficients
→ List<
Number> -
finalinherited
- degree → Integer
-
Get the degree of the Polynomial
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- polynomial ↔ Polynomial
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
coefficient(
int degree) → Number? -
Returns the coefficient of the Polynomial whose degree is
degree
.inherited -
copyWith(
{Complex? a, Complex? b}) → Linear -
depth(
) → int -
Calculate the depth of the expression tree.
inherited
-
differentiate(
) → Polynomial -
Returns the derivative of the quadratic equation.
inherited
-
discriminant(
) → Number -
override
-
evaluate(
[dynamic x]) → Number -
Evaluates the Polynomial for a given x value.
inherited
-
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.
inherited
-
factorizeString(
) → String -
Returns a list of string polynomial factors derived from the complex roots of a polynomial.
inherited
-
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 bothx
andy
.inherited -
getVariableTerms(
) → Set< Variable> -
Retrieves all variables present in the expression, including composite
variables like
x^2
orx*y
.inherited -
integrate(
[dynamic start, dynamic end]) → Expression -
Returns the integral of the Polynomial equation from 0 to x.
inherited
-
isIndeterminate(
num x) → bool -
inherited
-
isInfinity(
num x) → bool -
Simplified. Check if the evaluation at x is infinite.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
roots(
) → List< Number> -
override
-
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
inherited
-
size(
) → int -
Compute the size of the expression based on the number of nodes in its tree.
inherited
-
substitute(
Expression oldExpr, Expression newExpr) → Expression -
Replace a sub-expression or a variable with another expression.
inherited
-
toString(
[bool useUnicode = true]) → String -
Returns the string representation of the expression.
inherited
Operators
-
operator *(
dynamic other) → Expression -
Multiply operator. Creates a Multiply expression.
inherited
-
operator +(
dynamic other) → Expression -
Add operator. Creates an Add expression.
inherited
-
operator -(
dynamic other) → Expression -
Subtract operator. Creates a Subtract expression.
inherited
-
operator /(
dynamic other) → Expression -
Divide operator. Creates a Divide expression.
inherited
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → Number -
Returns the coefficient of the Polynomial at the given
index
position. For example:inherited -
operator ^(
dynamic other) → Expression -
Modulo operator. Creates a
Modulo
expression. Power operator. Creates a Pow expression.inherited -
operator unary-(
) → Expression -
Unary minus operator. Creates a Negate expression.
inherited