Learn R Programming

cmna (version 0.1.2)

ivpsys: Initial value problems for systems of ordinary differential equations

Description

solve initial value problems for systems ordinary differential equations

Usage

eulersys(f, x0, y0, h, n)

Arguments

f
function to integrate
x0
the initial value of x
y0
the vector initial values of y
h
selected step size
n
the number of steps

Value

a data frame of x and y values

Details

The euler method implements the Euler method for solving differential equations. The codemidptivp method solves initial value problems using the second-order Runge-Kutta method. The rungekutta4 method is the fourth-order Runge-Kutta method.

Examples

Run this code
f <- function(x, y) { y / (2 * x + 1) }
ivp.euler <- euler(f, 0, 1, 1/100, 100)

Run the code above in your browser using DataLab