Math on the Cloud
FacebookTwitterInstagram

Second-Order Autonomous Ordinary Differential Equation(ODE) with Inputs (version 1.4)

This page/program provides numerical solution of a 2nd-order ODE in the form of 2 equations:          
dy0/dt=f0(y0,y1,t)=F0(y0,y1)+K0*u(t),
dy1/dt=f1(y0,y1,t)=F1(y0,y1)+K1*u(t),
at t=0, y0(t)=y0(0), y1(t)=y1(0).

In math equation style:
`dy_0/dt=f_0(y_0,y_1,t)=F_0(y_0,y_1)+K_0*u(t),`
`dy_1/dt=f_1(y_0,y_1,t)=F_1(y_0,y_1)+K_1*u(t),`
`at` `t=0, y_0(t)=y_0(0), y_1(t)=y_1(0).`

Another form of 2nd-order ODE, `y''=F(y, y')+K*u(t)`, is a special case of the above 2-equation form.
Let `y=y_0, y'=y_1, K_0=0, K_1=K,` then `F_0(y_0,y_1)=y_1,` and `F_1(y_0,y_1)=F(y,y')=F(y_0,y_1)`

When you open this page, the solution/simulation of a default/pre-defined example ODE is ready to run.
  1. Click "Solve" button to run and display the solution for the ODE over a time period of: [0, T], where T=N*dT.
  2. Or Click "Start/Reset" button to run the ODE simulation continuously, you can stop, continue, or reset the simulation process.
  3. A set of ODE examples are provided, use the selection menu to select one set of the pre-defined example functions for the ODE, then stop the running ODE, and start/reset again to run the selected example.
  4. Clicking on the "Phase Plane" plot area equals to: (1)-Set the respective initial values as the clicked point position; and (2)-Same as clicking "Solve" button to start a new ODE solution process with the new initial values.
A brief description of the ODE examples is at the end of this page.

To define your own ODE system, just input or re-define the ODE functions and parameters:
  1. Functions: F0(y0,y1), and F1(y0,y1).
  2. Initial values: y0(0), and y1(0).
  3. K0, and K1, to control the input signal u(t) to each ODE channel/equation.
  4. dT--integration/sampling step-size, and N--number of data to display in the 2 graph plotters. Then, click "Solve" or "Start/Reset" button to start your new ODE solution/simulation.
A more detailed usage of this ODE tool is at the end of this page.

For definition of the ODE functions F0(y0,y1), and F1(y0,y1), see "Supported Operators and Functions".
Restart/Reload This Web Page

Menu to Select Variables to Display by the Oscilloscope/Plotter:

Keep Graph Shape or Not:

Click "Start" or "Solve" Button to Run the Predefined Example
Set Time Step Size dT(sec) , Number of Data to Display N, and Initial Values y0(0), y1(0):
dT:N:y0(0):y1(0):


Input Your Own Functions: F0(y0, y1), and F1(y0, y1), or Use the Example Functions:
F0(y0, y1):
F1(y0, y1):

Menu to Select an Input Signal u(t):
u(t):
Set Signal Period Ts(sec), Amplitude Am, and K0, K1:
Ts:Am:K0:K1:

Saved Projects:

How to save your projects for later use:
Click "Save Project" to save the current project to your device. All necessary function(s) and parameters will be saved.
Click "Load Project" to load a saved project and run it.
Click "Delete Project" to remove the selected project from your device.
Note: Your projects will remain saved to your device unless you delete them or you clear the site data of your browser.

Sharing your projects:
To create a URL link for the current project, click the "Share Function" button below the graph(s).
This will copy a link containing the current project to your clipboard that you can share with others.
You can also save a PNG image of the current graph by clicking the "Save Graph as Image" button.

Disclaimer: No data saved with these tools are kept by or sent to mathonthecloud.com. Everything is saved locally to your device only.

Example list of the ODE Tool:

This program provide a set of ODE examples to demo the function F0(y0,y1) and F1(y0,y1) formula syntax. Use the "Menu to Select,,," to view and select one set of the example functions. Then stop the running ODE and click "Solve" or "Start/Reset" button to run the selected ODE example.
  • Example default: a van der Pol oscillator.
  • Example 1: two independent 1st order linear system driven by a periodic signal u(t).
  • Example 2: a van der Pol oscillator, with initial point outside the limit-cycle. The ODE needs run some time(about 25 sec) to reach the limit-cycle.
  • Example 3: a harmonic oscillator, free, no damping.
  • Example 4: two independent 1st order linear system driven by a periodic signal u(t), with yi(0)=0.
  • Example 5: a harmonic oscillator, with damping, driven by a periodic signal u(t).
  • Example 6: the ODE becomes a pure time integrator. y1(t) becomes an integral of the signal u(t), and y0(t) becomes a double integral of u(t).
  • Example 7: a harmonic oscillator, with damping, converges to O point.

More Usage Information for the ODE Tool:

Two types of ODE solutions are provided:
  1. Numerical solution over a definite time period [0, T], where T=N*dT.
  2. Run calculation/simulation of the ODE system continuously, to display/demonstrate the ODE system outputs which are driven by a periodical input signal, or the system outputs which form limit-cycles, or the system outputs which become chaotic solutions or attractors.
The classic explicit fourth-order Runge-Kutta method(RK4) is used as numerical integration method in this program.

  • Usually the value of N can be set between 1000 to 20000. A bigger N will display more data in the graph plotter, but will also cost more memory or even cause a stack overflow problem, and hence stop the program.
  • Currently, the ODE solver/tool employs a 'fixed step size' integration method and the step size dT must be set by the user. Theoretically, a proper value of step size dT can be determined according to the ODE's maximum state changing rate, maximum inherent frequency(or minimum period), minimum time-constant, and/or the so-called stiffness.
  • As a practical approach, you can begin with a small dT and use the "Solve" button, to get initial yi(t)(i=0,1) displays, and then use the yi(t) displays to obtain a rough estimate of the ODE's minimum time-constant(or minimum period).
  • Usually dT can be set between 1/20 to 1/5 of the minimum time-constant (or minimum period) for most non-stiff ODEs. A smaller dT will lead to higher accuracy, but will cause longer computation time as well.
  • You can try different combinations of dT and N values, to get a stable and accurate ODE solution, and also nice graph displays, at the same time.
  • A special tool for exploring relationship between the step size and accuracy of the ODE solution will be developed and added to our website.
  • In the future, the so-called 'adaptive step size' algorithms may be added to our ODE solvers/tools. Then, the step size will be variable during the integration process according to the dynamical characteristics of the ODE. That is, the step size dT will be automatically determined by the ODE solver itself, and the user just need to set error tolerance parameters optionally.

  • The input signal u(t) is provided as a set of selectable time signals for test and verification purposes.
    Currently, eight types of input signals u(t) are provided: five types of periodic signals, one constant signal, and two types of stochastic signals.
  • For periodic u(t), you can set signal period Ts, and magnitude Am. To keep accuracy of the periodic u(t), the value of Ts is limited to Ts>=50*dT.
  • Set amplitude Am=0 will let u(t)=0, same as remove the input signal. Ki(i=0,1) are used to apply u(t) to channel i. Set Ki=0 will remove the input signal from the respective channel, and Ki>1 will amplify the signal.

  • After the 'phase plane' coordinates are established, move the Mouse cursor over the phase plane will display the mouse position [y0, y1]. Click the Mouse left key, will start a "Solve" process with the displayed [y0, y1] as the initial condition of the ODE. That is, the solution trajectory will start from the clicked [y0, y1] point. Notice that both the phase plane and oscilloscope plotters are auto-scaled and auto-centered, the clicked initial point [y0, y1] may be displayed in a new coordinates/grids immediately. Before click again, you need to move the Mouse over the phase plane to update the mouse position display .
  • The phase plane graph is auto-scaled and auto-centered on the canvas. If the checkbox "Keep Graph Shape or Not" is checked, the plotter uses the same scale factor in both x and y directions and the graph will keep its original shape. If the checkbox is unchecked, the graph will be stretched in one direction to make full use of the canvas plot area.
  • On the phase plane graph, a series of colored dots, spectrum from blue to red, are used to indicate the moving direction and/or moving speed of the solution points on the plotted graph.
  • If you changed any input parameter or the function selection, you need to "stop" the program and "start" again to let the new parameter and/or function selection be read and used in the new ODE solution.
  • For "Solve" button started solution, if you change any checkbox status, you also need to click "Solve" button again to start a new solution with the new checkbox status.
  • In case an error occurs, the program will display a notice and may indicate the cause of the error. After the error is corrected, Click "Solve" or "Start/Reset" button to re-start a new solution process.


Math on the Cloud/ode2/ode2
©Math on the Cloud 2022-2024. Read our Privacy Policy and Terms & Conditions