physics
Class Newton

java.lang.Object
  extended by physics.Newton

public class Newton
extends java.lang.Object

This class contains the logic required to perform netwon's method of iterative root finding on single variable functions.


Nested Class Summary
static interface Newton.Function
          Newton.Function is an interface which specifies a function whose roots can be found by this class.
static class Newton.Result
          Newton.Result is a record type which aggregates the results of evaluating both a function at a point and its derriviative.
 
Field Summary
static Newton.Result UNDEFINED
          Conveience name for an undefined function result
 
Method Summary
static double findRoot(Newton.Function function, double initial_t)
          Performs netwon's method on function starting at initial_t and returns the solution.
static double findRoot(Newton.Function function, double t_min, double t_max, double t_step)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final Newton.Result UNDEFINED
Conveience name for an undefined function result

Method Detail

findRoot

public static double findRoot(Newton.Function function,
                              double t_min,
                              double t_max,
                              double t_step)

findRoot

public static double findRoot(Newton.Function function,
                              double initial_t)
Performs netwon's method on function starting at initial_t and returns the solution. If no solution is found, returns NaN