Class QuadraticSolver
java.lang.Object
com.github.gbenroscience.math.quadratic.QuadraticSolver
- Author:
- GBEMIRO
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal double[]Store the real root of the equation in the first index of the array Store the complex root of the equation in the second index of the arrayfinal double[]Store the real root of the equation in the first index of the array Store the complex root of the equation in the second index of the arrayfinal double[]Stores the roots of the equation. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
solutions
public final double[] solutionsStores the roots of the equation. If the solutions are not complex, then the 2 solutions are real numbers stored in index 0 and index 1 of this array. If the solutions are complex(check fieldcomplex), then index 0 contains the real part of the first complex solution and index 1 contains the complex part of the first complex solution. Index 2 contains the real part of the second complex solution and index 3 contains the complex part of the second complex solution. If the content of the 4th index(solutions[4]) is 0, then the equation has real roots. If the content of the 4th index(solutions[4]) is 1,then it has complex roots. -
complexCoords1
public final double[] complexCoords1Store the real root of the equation in the first index of the array Store the complex root of the equation in the second index of the array -
complexCoords2
public final double[] complexCoords2Store the real root of the equation in the first index of the array Store the complex root of the equation in the second index of the array
-
-
Constructor Details
-
QuadraticSolver
public QuadraticSolver(double a, double b, double c) - Parameters:
a- the co-efficient of the squared variableb- the co-efficient of the variablec- the constant term
-
-
Method Details
-
setA
public void setA(double a) - Parameters:
a- the co-efficient of the squared variable
-
getA
public double getA()- Returns:
- the co-efficient of the squared variable
-
setB
public void setB(double b) - Parameters:
b- the co-efficient of the variable
-
getB
public double getB()- Returns:
- the co-efficient of the squared variable
-
setC
public void setC(double c) - Parameters:
c- the constant term
-
getC
public double getC()- Returns:
- the constant term
-
isComplex
public final boolean isComplex() -
solve
- Returns:
- the solutions as a string of values.
-
soln
- Returns:
- the solutions as an array of values
-
toString
-
main
-