Class CubicEquation

java.lang.Object
gov.nih.mipav.model.algorithms.CubicEquation

public class CubicEquation extends Object
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
    Modifier and Type
    Field
    Description
    private double
     
    private double
     
    private double
     
    private double
     
    private int[]
     
    private double[]
     
    private double[]
     
    private double[]
     
    private double[]
     
    private double[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    CubicEquation(double a1, double b, double c, double d, double[] x1real, double[] x2real, double[] x2imag, double[] x3real, double[] x3imag, int[] result)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
     
    void
     
    double
    Xroot(double a, double x)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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)