Package gov.nih.mipav.model.algorithms
Class CubicEquation
java.lang.Object
gov.nih.mipav.model.algorithms.CubicEquation
This is a port of code written by Gerolamo Cardano under the Code Project Open Licence.
A copy of the license if found at https://www.codeproject.com/info/cpol10.aspx.
The equation is a1*x**3 + b*x**2 + c*x + d = 0
If result = 0, a1 = 0
If result = 1, x1 is real and x2 and x3 are complex with x3 = complex conjugate of x2
If result = 2, there are 3 real roots of which at least 2 are equal
If result = 3, 3 real and unequal roots are found
- Author:
- ilb
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCubicEquation(double a1, double b, double c, double d, double[] x1real, double[] x2real, double[] x2imag, double[] x3real, double[] x3imag, int[] result) -
Method Summary
-
Field Details
-
a1
private double a1 -
b
private double b -
c
private double c -
d
private double d -
x1real
private double[] x1real -
x2real
private double[] x2real -
x2imag
private double[] x2imag -
x3real
private double[] x3real -
x3imag
private double[] x3imag -
result
private int[] result
-
-
Constructor Details
-
CubicEquation
public CubicEquation() -
CubicEquation
public CubicEquation(double a1, double b, double c, double d, double[] x1real, double[] x2real, double[] x2imag, double[] x3real, double[] x3imag, int[] result)
-
-
Method Details
-
selfTest
public void selfTest() -
run
public void run() -
Xroot
public double Xroot(double a, double x)
-