Package math.equations
Class Linear
java.lang.Object
math.equations.Polynomial
math.equations.Linear
public class Linear extends Polynomial
Represents a linear polynomial and provides a way to solve it.
-
Field Summary
Fields Modifier and Type Field Description double
a
The coefficient of the linear term.double
b
The constant.Fields inherited from class math.equations.Polynomial
EMPTY_ARRAY
-
Constructor Summary
Constructors Constructor Description Linear(double a, double b)
Constructor of linear equations. -
Method Summary
Modifier and Type Method Description double[]
solutions()
Calculates the solutions of the equation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
a
public final double aThe coefficient of the linear term. -
b
public final double bThe constant.
-
-
Constructor Details
-
Linear
public Linear(double a, double b)Constructor of linear equations.- Parameters:
a
- The coefficient of the linear term. This may not be 0, else the equation has either zero on infinitely many solutionsb
- The constant
-
-
Method Details
-
solutions
public double[] solutions()Description copied from class:Polynomial
Calculates the solutions of the equation.- Specified by:
solutions
in classPolynomial
- Returns:
- An array of doubles containing the solutions, if any.
-