Class QuarticRootFerrari
- java.lang.Object
-
- dev.nm.analysis.function.polynomial.root.QuarticRootFerrari
-
- All Implemented Interfaces:
QuarticRoot.QuarticSolver
public class QuarticRootFerrari extends Object implements QuarticRoot.QuarticSolver
This is a quartic equation solver that solves \(ax^4 + bx^3 + cx^2 + dx + e = 0\) using the Ferrari method.
-
-
Constructor Summary
Constructors Constructor Description QuarticRootFerrari()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Number>
solve(double a, double b, double c, double d, double e)
Solve \(ax^4 + bx^3 + cx^2 + dx + e = 0\).List<Number>
solve(double a, double b, double c, double d, double e, double epsilon)
Solve \(ax^4 + bx^3 + cx^2 + dx + e = 0\).List<Number>
solve(Polynomial polynomial)
Solve \(ax^4 + bx^3 + cx^2 + dx + e = 0\).
-
-
-
Method Detail
-
solve
public List<Number> solve(double a, double b, double c, double d, double e, double epsilon)
Solve \(ax^4 + bx^3 + cx^2 + dx + e = 0\).- Parameters:
a
- ab
- bc
- cd
- de
- eepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0- Returns:
- the list of roots
- See Also:
- Wikipedia: Ferrari's solution
-
solve
public List<Number> solve(double a, double b, double c, double d, double e)
Description copied from interface:QuarticRoot.QuarticSolver
Solve \(ax^4 + bx^3 + cx^2 + dx + e = 0\).- Specified by:
solve
in interfaceQuarticRoot.QuarticSolver
- Parameters:
a
- ab
- bc
- cd
- de
- e- Returns:
- the list of roots
-
solve
public List<Number> solve(Polynomial polynomial)
Solve \(ax^4 + bx^3 + cx^2 + dx + e = 0\).- Parameters:
polynomial
- a quartic equation to be solved- Returns:
- the roots of the quartic equation
- Throws:
IllegalArgumentException
- if the polynomial degree is not 4
-
-