# Random Ordinary Differential Equations

This tutorial will introduce you to the functionality for solving RODEs. Other introductions can be found by checking out DiffEqTutorials.jl.

Note

This tutorial assumes you have read the Ordinary Differential Equations tutorial.

## Example 1: Scalar RODEs

In this example we will solve the equation

$du = f(u,p,t,W)dt$

where $f(u,p,t,W)=2u\sin(W)$ and $W(t)$ is a Wiener process (Gaussian process).

using DifferentialEquations
function f(u,p,t,W)
2u*sin(W)
end
u0 = 1.00
tspan = (0.0,5.0)
prob = RODEProblem(f,u0,tspan)
sol = solve(prob,RandomEM(),dt=1/100) The random process defaults to a Gaussian/Wiener process, so there is nothing else required here! See the documentation on NoiseProcesses for details on how to define other noise proceses.

## Example 2: Systems of RODEs

As with the other problem types, there is an in-place version which is more efficient for systems. The signature is f(du,u,p,t,W). For example,

using DifferentialEquations
function f(du,u,p,t,W)
du = 2u*sin(W - W)
du = -2u*cos(W + W)
end
u0 = [1.00;1.00]
tspan = (0.0,5.0)
prob = RODEProblem(f,u0,tspan)
sol = solve(prob,RandomEM(),dt=1/100) By default, the size of the noise process matches the size of u0. However, you can use the rand_prototype keyword to explicitly set the size of the random process:

function f(du,u,p,t,W)
du = -2W*u*sin(W - W)
du = -2u*cos(W + W)
end
u0 = [1.00;1.00]
tspan = (0.0,5.0)
prob = RODEProblem(f,u0,tspan,rand_prototype=zeros(3))
sol = solve(prob,RandomEM(),dt=1/100) 