Documentation API of the 'edu.rit.numeric.Cubic' Java class
Cubic
edu.rit.numeric

Class Cubic



  • public class Cubicextends Object
    Class Cubic solves for the real roots of a cubic equation with real coefficients. The cubic equation is of the form

    ax3 + bx2 + cx + d = 0

    To solve a cubic equation, construct an instance of class Cubic; call the Cubic object's solve() method, passing in the coefficients a, b, c, and d; and obtain the roots from the Cubic object's fields. The number of (real) roots, either 1 or 3, is stored in field nRoots. If there is one root, it is stored in field x1, and fields x2 and x3 are set to NaN. If there are three roots, they are stored in fields x1, x2, and x3 in descending order.

    The same Cubic object may be used to solve several cubic equations. Each time the solve() method is called, the solution is stored in the Cubic object's fields.

    The formulas for the roots of a cubic equation come from:

    E. Weisstein. "Cubic formula." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/CubicFormula.html

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.