Class CubicRoot
- java.lang.Object
-
- dev.nm.analysis.function.polynomial.root.CubicRoot
-
- All Implemented Interfaces:
PolyRootSolver
public class CubicRoot extends Object implements PolyRootSolver
This is a cubic equation solver. This implementation solves \(ax^3 + bx^2 + cx + d = 0\) using Cardano's method.
-
-
Constructor Summary
Constructors Constructor Description CubicRoot()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Number>
solve(Polynomial polynomial)
Solve \(ax^3 + bx^2 + cx + d = 0\).
-
-
-
Method Detail
-
solve
public List<Number> solve(Polynomial polynomial)
Solve \(ax^3 + bx^2 + cx + d = 0\).- Specified by:
solve
in interfacePolyRootSolver
- Parameters:
polynomial
- a cubic equation to be solved- Returns:
- the roots of the cubic equation
- Throws:
IllegalArgumentException
- if the polynomial degree is not 3
-
-