@Status(stage=PRODUCTION, unitTests=COMPLETE) @Review(by="Kees Schotanus", at="2009-11-21", reason="Initial review") @ThreadSafety(level=IMMUTABLE) public final class QuadraticEquation extends Object
Discriminant | Roots |
---|---|
Negative | Two complex solutions |
Zero | One (repeated) real solution |
Positive | Two real solutions |
Constructor and Description |
---|
QuadraticEquation(double a,
double b,
double c)
Creates this QuadraticEquation from the supplied a, b and c.
|
Modifier and Type | Method and Description |
---|---|
Complex[] |
getComplexRoots()
Gets the Complex roots.
|
double |
getDiscriminant()
Gets the Discriminant.
|
int |
getNumberOfRoots()
Gets the number of roots of this quadratic equation.
|
double[] |
getRealRoots()
Gets the real roots.
|
public QuadraticEquation(double a, double b, double c)
a
- The value of the quadratic coefficient.
b
- The value of the linear coefficient.c
- The value of the constant term.public double getDiscriminant()
public int getNumberOfRoots()
public double[] getRealRoots()
ArithmeticException
- When no real roots exist.public Complex[] getComplexRoots()
ArithmeticException
- When no Complex roots exist.Copyright © 2008–2018. All rights reserved.