Overview 

Package 

 Class 

Use 

Tree 

Deprecated 

Index 

Help 

 

 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES    

 

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

 

size=2 width="100%" align=center>

integrator
Class RungeKutta

 
java.lang.Object
  extended byintegrator.RungeKutta

public class RungeKutta

extends java.lang.Object

Runge Kutta integrator. Inspired by Numerical Recipes in C by Press, William H., Teukolsky, Saul A., Vettering, William T., Flannery, Brian P.

This class keeps the equation to be integrated, initial conditions, eps parameter and other variables. It also has methods to numerically integrate the equation.

Author:

A.K.Nircan


Field Summary

private  double[]

ak2
           

private  double[]

ak3
           

private  double[]

ak4
           

private  double[]

ak5
           

private  double[]

ak6
           

private  double

eps
           

private  Equation

eq
           

(package private) static double

ERRCON
           

private  double

hdid
           

private  double

hmin
           

private  double

hnext
           

(package private) static int

MAXSTP
           

private  int

nbad
           

private  int

nok
           

private  int

nvar
           

(package private) static double

PGROW
           

(package private) static double

PSHRNK
           

(package private) static double

SAFETY
           

(package private) static double

TINY
           

private  double

x
           

private  double[]

y
           

private  double[]

yerr
           

private  double[]

ytemp
           

 

Constructor Summary

RungeKutta(Equation eq, double eps, double[] ystart, double xstart, double hmin)
          Constructs the integrator.

 

 

Method Summary

 Equation

getEq()
           

 double

getHdid()
           

 double

getHnext()
           

 int

getNbad()
           

 int

getNok()
           

 int

getNvar()
           

 double

getX()
           

 double[]

getY()
           

 void

integrate(double step, double stepTry)
          Integrates Equation eq and takes it from its current state to step ahead.

 void

rkCashKrap(double[] dydx, double h, double[] yout)
          Uses fifth order Cash-Krap Runge-Kutta method to find the solution h steps ahead.

 void

rungeKuttaStep(double[] dydx, double htry, double[] yscal)
          Takes y one step (htry) further.

 void

setX(double x)
          Set current x

 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

SAFETY

 
static final double SAFETY

See Also:

Constant Field Values


PGROW

 
static final double PGROW

See Also:

Constant Field Values


PSHRNK

 
static final double PSHRNK

See Also:

Constant Field Values


ERRCON

 
static final double ERRCON

See Also:

Constant Field Values


MAXSTP

 
static final int MAXSTP

See Also:

Constant Field Values


TINY

 
static final double TINY

See Also:

Constant Field Values


x

 
private double x

y

 
private double[] y

hdid

 
private double hdid

hnext

 
private double hnext

nvar

 
private int nvar

eq

 
private Equation eq

eps

 
private double eps

hmin

 
private double hmin

nok

 
private int nok

nbad

 
private int nbad

yerr

 
private double[] yerr

ak2

 
private double[] ak2

ak3

 
private double[] ak3

ak4

 
private double[] ak4

ak5

 
private double[] ak5

ak6

 
private double[] ak6

ytemp

 
private double[] ytemp

Constructor Detail

RungeKutta

 
public RungeKutta(Equation eq,
                  double eps,
                  double[] ystart,
                  double xstart,
                  double hmin)

Constructs the integrator.

Parameters:

eq - Equation to be integrated

eps - sensitivity of the integration

ystart - starting system variables

xstart - starting

hmin - minimum step allowed in integration.

Method Detail

rkCashKrap

 
public final void rkCashKrap(double[] dydx,
                             double h,
                             double[] yout)

Uses fifth order Cash-Krap Runge-Kutta method to find the solution h steps ahead. Uses class variable y to do the calculation. Updates yout and yerr.

Parameters:

dydx - derivatives.

h - step to be taken.

yout - results at h steps ahead.


rungeKuttaStep

 
public final void rungeKuttaStep(double[] dydx,
                                 double htry,
                                 double[] yscal)

Takes y one step (htry) further.

Parameters:

dydx - derivatives

htry - step to be taken

yscal - used to calculate error.


integrate

 
public final void integrate(double step,
                            double stepTry)

Integrates Equation eq and takes it from its current state to step ahead. Method will first try stepTry before adjusting the step.

Parameters:

step - length of the step which will advance x .

stepTry - length of the first trial. stepTry<= step


getNvar

 
public int getNvar()

Returns:

number of variables


getX

 
public double getX()

Returns:

the current x


setX

 
public void setX(double x)

Set current x

Parameters:

x - set


getY

 
public double[] getY()

Returns:

system variables or results.


getEq

 
public Equation getEq()

Returns:

equation


getHdid

 
public double getHdid()

Returns:

step taken.


getHnext

 
public double getHnext()

Returns:

next step to be taken.


getNbad

 
public int getNbad()

Returns:

number of bad attempts during integration.


getNok

 
public int getNok()

Returns:

number of good attempts during integration.

size=2 width="100%" align=center>

Overview 

Package 

 Class 

Use 

Tree 

Deprecated 

Index 

Help 

 

 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES    

 

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

 

size=2 width="100%" align=center>