com.bbn.openmap.geo
Class Quadratic

java.lang.Object
  extended by com.bbn.openmap.geo.Quadratic

public class Quadratic
extends java.lang.Object

Computes 0 to 2 real roots of the quadratic:

    a*x^2 + b*x + c = 0
 
See http://web.cs.mun.ca/courses/cs2710-w02/lab5/assignment/assign5.html. http://www.1728.com/quadratc.htm

Access the roots as a double iterator with methods hasNext() and next().


Constructor Summary
Quadratic(double a, double b, double c)
           
 
Method Summary
 double eval(double x)
          Evaluate the Quadratic at x.
 boolean hasNext()
           
static double linear(double a, double b)
          Returns the solution, x, to the equation a*x+b = 0
static void main(java.lang.String[] args)
           
 double next()
           
 void solve()
          Solve a*x^2 + b*x + c = 0 for x for real values of x.
 java.lang.String test()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Quadratic

public Quadratic(double a,
                 double b,
                 double c)
Method Detail

linear

public static double linear(double a,
                            double b)
Returns the solution, x, to the equation a*x+b = 0


solve

public void solve()
Solve a*x^2 + b*x + c = 0 for x for real values of x.

See Winston and Horn, LISP p. 167-169.


eval

public double eval(double x)
Evaluate the Quadratic at x.


hasNext

public boolean hasNext()

next

public double next()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

test

public java.lang.String test()

main

public static void main(java.lang.String[] args)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details