org.vizzini.math
Class Quadratic

java.lang.Object
  extended by org.vizzini.math.Quadratic

public final class Quadratic
extends Object

Provides a quadratic equation. The quadratic equation is Ax^2 + Bx + C = 0.

Since:
v0.2
Version:
v0.2
Author:
Jeffrey M. Thompson

Constructor Summary
Quadratic(double a, double b, double c)
          Construct this object using the given parameters.
 
Method Summary
 double evaluate(double x)
          Return the result of using the given parameter in the quadratic equation Ax^2 + Bx + C.
 double getA()
          Return the A component.
 double getB()
          Return the B component.
 double getC()
          Return the C component.
 double[] solutions()
          Return the solution(s) of this quadratic equation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Quadratic

public Quadratic(double a,
                 double b,
                 double c)
Construct this object using the given parameters.

Since:
v0.2
Method Detail

getA

public double getA()
Return the A component.

Since:
v0.2

getB

public double getB()
Return the B component.

Since:
v0.2

getC

public double getC()
Return the C component.

Since:
v0.2

evaluate

public double evaluate(double x)
Return the result of using the given parameter in the quadratic equation Ax^2 + Bx + C. If x is a solution to the equation, the answer is 0.0.

Parameters:
x - Input parameter.
Since:
v0.2

solutions

public double[] solutions()
Return the solution(s) of this quadratic equation. This method ignores imaginary solutions.

Returns:
Array of zero, one or two solutions. The solutions are in increasing order.
Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02