net.sf.doodleproject.numerics4j.root
Class Bracket

java.lang.Object
  extended by net.sf.doodleproject.numerics4j.root.Bracket

public class Bracket
extends java.lang.Object

Simple root bracketing routine. Starting with an initial point, a closed interval can be created known to contain at least one root for a function.

Version:
$Revision: 1.2 $ $Date: 2007/10/25 04:44:14 $

Constructor Summary
Bracket(Function f)
          Create a root bracketer for the given function.
Bracket(Function f, int iterations)
          Create a root bracketer for the given function.
 
Method Summary
 double[] bracketOut(double lower, double initial, double upper)
          Bracket a root for the target function by creating and continuously expanding an interval around the initial point until the interval is known to contain at least one root.
 Function getFunction()
          Access the target function.
 int getMaximumIterations()
          Access the maximum number of iterations.
 void setFunction(Function f)
          Modify the target function.
 void setMaximumIterations(int iterations)
          Modify the maximum number of iterations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bracket

public Bracket(Function f)
Create a root bracketer for the given function.

Parameters:
f - the target function.

Bracket

public Bracket(Function f,
               int iterations)
Create a root bracketer for the given function.

Parameters:
f - the target function.
iterations - maximum number of iterations.
Method Detail

bracketOut

public double[] bracketOut(double lower,
                           double initial,
                           double upper)
                    throws NumericException
Bracket a root for the target function by creating and continuously expanding an interval around the initial point until the interval is known to contain at least one root. An interval is determined to contain at least one root when the function evaluation at the inteval endpoints are oppisite signs.

Parameters:
lower - the lowest possible lower bound for the bracketting interval. The lower bound for the returned interval will never be smaller than lower.
initial - the start point used to create the bracketting interval.
upper - the largest possible upper bound for the bracketting interval. The upper bound for the returned interval will never be larger than upper.
Returns:
a two element array containing the lower and upper bounds of the bracketting interval.
Throws:
NumericException - if a root could not be bracketed.

getFunction

public Function getFunction()
Access the target function.

Returns:
the target function.

getMaximumIterations

public int getMaximumIterations()
Access the maximum number of iterations.

Returns:
the maximum number of iterations.

setFunction

public void setFunction(Function f)
Modify the target function.

Parameters:
f - the new target function.

setMaximumIterations

public void setMaximumIterations(int iterations)
Modify the maximum number of iterations.

Parameters:
iterations - the new maximum number of iterations.


Copyright 2004-2004-2007 DoodleProject. All Rights Reserved.