SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.function.polynomial.root
Class Quartic

java.lang.Object
  extended by com.numericalmethod.suanshu.analysis.function.polynomial.root.Quartic
All Implemented Interfaces:
Solver

public class Quartic
extends java.lang.Object
implements Solver

This is a quartic equation solver.

Solve

ax4 + bx3 + cx2 + dx + e = 0

See Also:
Wikipedia: Quartic equation

Nested Class Summary
static interface Quartic.QuarticSolver
          This defines a quartic equation solver.
 
Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.polynomial.root.Solver
Solver.RootFindingException, Solver.Type
 
Constructor Summary
Quartic()
          Construct a quartic equation solver.
Quartic(Quartic.QuarticSolver solver)
          Construct a quartic equation solver using a customized solver.
 
Method Summary
 NumberList solve(Polynomial polynomial)
          Solve ax4 + bx3 + cx2 + dx + e = 0
 Solver.Type type()
          Get the type of the solver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Quartic

public Quartic(Quartic.QuarticSolver solver)
Construct a quartic equation solver using a customized solver.

Parameters:
solver - the implementation of QuarticSolver to use

Quartic

public Quartic()
Construct a quartic equation solver.

Method Detail

type

public Solver.Type type()
Description copied from interface: Solver
Get the type of the solver.

Specified by:
type in interface Solver
Returns:
the solver type

solve

public NumberList solve(Polynomial polynomial)
Solve
ax4 + bx3 + cx2 + dx + e = 0

Specified by:
solve in interface Solver
Parameters:
polynomial - the quartic polynomial to be solved
Returns:
a list of all roots in Number
Throws:
java.lang.IllegalArgumentException - if the polynomial degree is not 4

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.