Class CubicEquation
java.lang.Object
net.rodofire.easierworldcreator.maths.equation.CubicEquation
Class based on the cubic equation solver provided by WattZap.
License: GNU General Public License
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsolve(double a, double b, double c, double d) Solve the cubic equation with the given coefficients.
-
Field Details
-
nRoots
public int nRootsThe number of real roots. -
x1
public double x1The first real root. -
x2
public double x2The second real root. -
x3
public double x3The third real root.
-
-
Constructor Details
-
CubicEquation
public CubicEquation()Construct a new Cubic object.
-
-
Method Details
-
solve
public void solve(double a, double b, double c, double d) Solve the cubic equation with the given coefficients. The results are stored in this Cubic object's fields.- Parameters:
a- Coefficient of x3.b- Coefficient of x2.c- Coefficient of x.d- Constant coefficient.
-