Welcome,
Share Files

Differential Equation System Numeric Solver/Plotter

To simplify the package and reduce the computational power necessary to solve an ode system accurately, I have made the fifth order Runge Kutta method the default method. To avoid the slow-downs and large amount of memory necessary for using smaller step sizes for solutions, I have given each function two step sizes: the plotting step size and the solver step size. This way, the amount of the points that must be kept in memory is drastically reduced.

This numeric ode solver package solves a system of differential equations given in the form dy1/dx=f1(x,y1,...,yn),...,dyn/dx=fn(x,y1,...,yn) where the initial conditions y1(xo),...,yn(xo) are known. The results can be plotted, outputted into a table, parametrically plotted, or the final values could simply be outputted.

Solver inputs
[list=]
[*]List dfdx: ode's given as the list [df1/dx,...,dfn/dx]
[*]List variables: variables given as the list [independantVariable,f1,...,fn].
Note that the variables must be given in the same order in dfdx and vars and the first variable in the variables list must be the independant variable (x,time,etc)
[*]NumberList ics: initial conditions given as [f1,...,fn]. Note that the first x (independant variable) value is not given here. Once again, order is very important here.
[*]NumberList xrange: range of x (independant variable) value is given here as [x0,xf]
[*]Number h: Step size used in the solver. By default, it is 0.5. It can be specified, though.
[*]Number hPlot: Increment of values to be plotted or reported to the table. For examble, hPlot=10 will plot every 10th x value and the corresponding y values.
[/list]
Note that any variables can be used as long as the variables are inputted in order.

Functions
[list=]
[*]nDSolvePlot(dfdx,variables,ics,xrange,h=0.5,hPlot=1): Plots the results of the specified ode system and initial conditions.
[*]nDSolveTable(dfdx,variables,ics,xrange,h=0.5,hPlot=1): Return a table of values for the specified ode system and initial conditions
[*]nDSolveValue(dfdx,variables,ics,xrange,h=0.5): Returns the final values of the variables in the given ode system and initial conditions.
[*]nDSolvePlot2DParameteric(dfdx,variables,ics,xrange,h=0.5,hPlot=1): Plots the results of the specified ode system and initial conditions parametrically on a 2D plot. For example, if the system is dfdt=[dx/dt,dy/dt], it will plot the x Vs. y results. if the system is dfdt=[dx/dt,dy/dt,dz/dt,dw/dt], the x Vs. y and z Vs. w will be plotted. This can be done for as many variables as desired as long as the number of equations specified is even.
[*]nDSolvePlot3DParameteric(dfdx,variables,ics,xrange,h=0.5,hPlot=1): Plots the results of the specified ode system and initial conditions parametrically on a 3D plot. For example, if the system is dfdt=[dx/dt,dy/dt,dz/dt], it will plot the points (x,y,z) on a 3d graph.
[/list]

This can be found on my graphbook page. Enjoy :)

Usage tips
*Any combination of variables can be used as long as they are given in the appropriate order in the inputs.
*As the step size is decreased and the range is increased, the computational power necessary increases. Generally, step sizes on the order of 0.1 and ranges should be on the order of 10. If you wish to increase range, you will get much more speed by increasing the plotting step size hPlot.

Please let me know if you find this type of thing useful as I make these scripts for my own personal use, but I'd post more of these types of things if there is a demand for it. If you ask nice, I might take requests :P