Class ImprovedSchrodinger

java.lang.Object
  |
  +--Schrodinger
        |
        +--ImprovedSchrodinger

class ImprovedSchrodinger
extends Schrodinger

A version of the Schrodinger class where all solution data is automatically cached, and the potential function may be changed more easily.

Some unnecessary generalisation has been removed to improve performance. For instance, it is assumed that the potential function does not change as a function of time.


Field Summary
protected  SolnCache cache
          A cache of the values of the potential function
 
Fields inherited from class Schrodinger
_2m_over_h_bar_sq, DEFAULT_ENERGY, E, energy, firstValue, H, M, pot
 
Constructor Summary
ImprovedSchrodinger(Function f)
          Creates a new Schrodinger solver
 
Method Summary
 void setPotentialFunction(Function f)
           
 void solve(double x, double h, double[] vals)
          Requests that the supplied array be filled with solution data.
 
Methods inherited from class Schrodinger
getEnergy, setEnergy
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cache

protected SolnCache cache
A cache of the values of the potential function
Constructor Detail

ImprovedSchrodinger

public ImprovedSchrodinger(Function f)
Creates a new Schrodinger solver
Parameters:
fn - The potential function
Method Detail

solve

public void solve(double x,
                  double h,
                  double[] vals)
Description copied from interface: Solvable
Requests that the supplied array be filled with solution data. The nth element of the array should be the solution at x = x0 + step*n.
Overrides:
solve in class Schrodinger
Tags copied from interface: Solvable
Parameters:
x0 - The initial x-value
step - The increment to be applied to x0
vals - The array which will hold the solution data

setPotentialFunction

public void setPotentialFunction(Function f)
Overrides:
setPotentialFunction in class Schrodinger