agi.foundation.numericalmethods
(agi.foundation.core-2023r1.jar)

## Class CubicRealPolynomial

• public class CubicRealPolynomial
extends RealPolynomial
Represents a 3rd order polynomial function of one variable with only real coefficients.
• ### Constructor Summary

Constructors
Constructor and Description
CubicRealPolynomial(double a, double b, double c, double d)
Constructs a cubic polynomial with the provided real coefficients.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double discriminant()
Provides the discriminant of the cubic equation from the supplied coefficients.
static double discriminant(double a, double b, double c, double d)
Provides the discriminant of the cubic equation from the supplied coefficients.
double getA()
Gets the coefficient of the 3rd order monomial.
double getB()
Gets the coefficient of the 2nd order monomial.
double getC()
Gets the coefficient of the 1st order monomial.
double getD()
Gets the coefficient of the 0th order monomial.
double[] realRoots()
Provides the real valued roots of the real polynomial.
static double[] realRoots(double a, double b, double c, double d)
Compute real roots.
• ### Methods inherited from class agi.foundation.numericalmethods.advanced.RealPolynomial

evaluate, evaluate, get, getOrder
• ### Constructor Detail

• #### CubicRealPolynomial

public CubicRealPolynomial(double a,
double b,
double c,
double d)
Constructs a cubic polynomial with the provided real coefficients.
Parameters:
a - The coefficient of the 3rd order monomial.
b - The coefficient of the 2nd order monomial.
c - The coefficient of the 1st order monomial.
d - The coefficient of the 0th order monomial.
• ### Method Detail

• #### getA

public final double getA()
Gets the coefficient of the 3rd order monomial.
• #### getB

public final double getB()
Gets the coefficient of the 2nd order monomial.
• #### getC

public final double getC()
Gets the coefficient of the 1st order monomial.
• #### getD

public final double getD()
Gets the coefficient of the 0th order monomial.
• #### realRoots

@Nonnull
public final double[] realRoots()
Provides the real valued roots of the real polynomial.
Returns:
An array containing the real valued roots.
• #### discriminant

public final double discriminant()
Provides the discriminant of the cubic equation from the supplied coefficients.
Returns:
The value of the discriminant.
• #### discriminant

public static double discriminant(double a,
double b,
double c,
double d)
Provides the discriminant of the cubic equation from the supplied coefficients.
Parameters:
a - The coefficient of the 3rd order monomial.
b - The coefficient of the 2nd order monomial.
c - The coefficient of the 1st order monomial.
d - The coefficient of the 0th order monomial.
Returns:
The value of the discriminant.
• #### realRoots

@Nonnull
public static double[] realRoots(double a,
double b,
double c,
double d)
Compute real roots.
Parameters:
a - The coefficient of the 3rd order monomial.
b - The coefficient of the 2nd order monomial.
c - The coefficient of the 1st order monomial.
d - The coefficient of the 0th order monomial.
Returns:
An array containing the real valued roots.