Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


The goal of rODE is to explore R and its S4 classes and the differences with Java and Python classes while exploring simulations by solving differential equations.

rODE is based in the extraordinary physics library for computer simulations OpenSourcePhyisics. Take a look at

The ODE solvers implemented in R so far:

  • Euler
  • Euler-Richardson
  • RK4
  • RK45, Dormand-Prince45
  • Verlet


You can install rODE from github with:

# install.packages("devtools")

Or from CRAN:



Example scripts are located under the folder examples inside the package.

These examples make use of a parent class containing a customized rate calculation as well as the step and startup method. The methods that you would commonly find in the base script or parent class are:

  • getRate()
  • getState()
  • step() or doStep()
  • setStepSize()
  • init(), not the same as the class initialize method
  • initialize(), and
  • the constructor

These methods are defined in the virtual classes ODE and ODESolver. Two other classes that serve as definition classes for the ODE solvers are: AbstractODESolver and ODEAdaptiveSolver.

For instance, the application KeplerApp.R needs the class Kepler located in the Kepler.R script, which is called with planet <- Kepler(r, v), an ODE object. The solver for the same application is RK45 called with solver <- RK45(planet). Since RK45 is an ODE solver, the script RK45.R will be located in the folder ./R in the package.


The vignettes contain examples of the use of the various ODE solvers. For instance, the notebook Comparison and Kepler` use the ODE solver `RK45`, `FallingParticle` and `Planet` use `Euler, Pendulum makes use of EulerRichardson, Planet of Euler, Projectile and Reaction of RK4, and KeplerEnergy uses the ODE solver Verlet.


There are tests for the core ODE solver classes under tests/testthat, as well as tests for the examples.

Tests for the examples

The tests for the examples are two: one for the base/parent classes such as Kepler or Planet or Projectile; this test runner is called run_tests_this_folder.R. For the applications themselves there is another runner that opens each of the applications as request for a return value. If the hard coded value is not returned, the test will fail. This ensures that any minor change in the core solver classes do not have any impact on the application solutions, and if there is, it must be explained. The name of the test runner is run_tes_applications.R.


a package for ODE solvers written in R with S4 classes. Based on OpenSourcePhysics project




No packages published