Numerical Tools  1.0
Numerical tools from SciPy and Numerical Methods in Physics with Python
NumericalTools.Ivp Class Reference

Central class for the port of the SciPy Solve_Ivp method to perform numerical integration of a system of ordinary differential equations using the error minimizing approaches RK23, RK45 or DOP853. More...

Classes

struct  Event
 Structure to define an Event for the DE solver. More...
 
class  OdeResult
 This class is a strut-like wrapper for the information associated with a DE solution. More...
 

Public Types

enum  Method { RK23, RK45, DOP853 }
 

Public Member Functions

delegate double [] DiffEqFunction (double t, double[] y, params object[] args)
 Prototype for a function that defines the system of differential equations to be solved. More...
 
delegate double EventFunction (double t, double[] y)
 Prototype for an EventFunction to be evaluated as the DE is being solved. More...
 
delegate void RTEventCallback (double t, double[] y)
 A function to be called when IvpRealtime events are triggered. More...
 

Static Public Member Functions

static List< int > FindActiveEvents (double[] g, double[] g_new, double[] direction)
 Not for external use. This method is public to allow access by IvpRealtime. More...
 
static OdeResult SolveIvp (DiffEqFunction fun, double[] t_span, double[] y0, Method method=Method.RK45, double[] t_eval=null, bool dense_output=false, List< Event > events=null, bool vectorized=false, params object[] args)
 SolveIvp is the partial implementation of the SciPy solve_ivp function. More...
 

Static Public Attributes

static bool [] isTerminal
 Not for external use. This method is public to allow access by IvpRealtime. More...
 
static List< int >
 Not for external use. This method is public to allow access by IvpRealtime. More...
 

Detailed Description

Central class for the port of the SciPy Solve_Ivp method to perform numerical integration of a system of ordinary differential equations using the error minimizing approaches RK23, RK45 or DOP853.

A summary of the features provided is at http://nbodyphysics.com/blog/numericaltools See the SciPy solve_ivp documentation for an in-depth reference.

Member Function Documentation

◆ DiffEqFunction()

delegate double [] NumericalTools.Ivp.DiffEqFunction ( double  t,
double []  y,
params object []  args 
)

Prototype for a function that defines the system of differential equations to be solved.

Parameters
ttime of the current state of the DE system
yCurrent state of the DE systems
args(optional) arguments as object[] that can be referenced by the DE system
Returns

◆ EventFunction()

delegate double NumericalTools.Ivp.EventFunction ( double  t,
double []  y 
)

Prototype for an EventFunction to be evaluated as the DE is being solved.

If the event function returns zero, the event MAY be triggered, depending on whether the associated Event structure has indicated that the result of the function must be in positive or negative direction.

Parameters
ttime of the current state of the DE system
yCurrent state of the DE systems
Returns

◆ FindActiveEvents()

static List<int> NumericalTools.Ivp.FindActiveEvents ( double []  g,
double []  g_new,
double []  direction 
)
inlinestatic

Not for external use. This method is public to allow access by IvpRealtime.

Parameters
g
g_new
direction
Returns

◆ RTEventCallback()

delegate void NumericalTools.Ivp.RTEventCallback ( double  t,
double []  y 
)

A function to be called when IvpRealtime events are triggered.

Parameters
ttime of the current state of the DE system
yCurrent state of the DE systems

◆ SolveIvp()

static OdeResult NumericalTools.Ivp.SolveIvp ( DiffEqFunction  fun,
double []  t_span,
double []  y0,
Method  method = Method.RK45,
double []  t_eval = null,
bool  dense_output = false,
List< Event events = null,
bool  vectorized = false,
params object []  args 
)
inlinestatic

SolveIvp is the partial implementation of the SciPy solve_ivp function.

The methods RK23, RK45 and DOP853 are implemented. Unit tests to compare the results of each method to the output from SciPy under python can be found in the QA directory of the asset.

Example code can be found in the NUnit tests as well as the directory: SciPyBased/Scenes/Solve_Ivp.

For a general overview see the Numerical Tools documentation at nbodyphysics.com

Parameters
funFunction that provides the description of the system of DEs
t_span(double[2]) Time range (from..to) to solve the DE system for
y0(double[n]) Initial conditions for the DE system
methodThe algorithm to use
t_evalA list of specific times that the DE system should be recorded at
dense_output(bool) Record intermediate values for later use with OdeResult.Call()
eventsList of event structs
vectorizedUnsupported
args
Returns

Member Data Documentation

◆ isTerminal

bool [] NumericalTools.Ivp.isTerminal
static

Not for external use. This method is public to allow access by IvpRealtime.

Parameters
events
Returns

◆ List< int >

NumericalTools.Ivp.List< int >
static

Not for external use. This method is public to allow access by IvpRealtime.

Parameters
sol
events
active_events
is_terminal
t_old
t
Returns

The documentation for this class was generated from the following file: