Solving SDE: $\frac{dy(t)}{dt}=(c+\sigma_wW(t))y(t)+\epsilon(t)$ in Mathematica

I want to solve this differential equation $\frac{dy(t)}{dt}=(c+\sigma_w W(t))y(t)+\epsilon(t)$. For details see https://math.stackexchange.com/questions/1385633/solving-sde-fracdytdt-c-sigma-wwtyt-epsilont. My approach is using Mathematica. However, I have not been able to specify this SDE in Mathematica. As far as I understand, the ItoProcess function is appropriate. I have come this far:

proc =
ItoProcess[
{\[DifferentialD]y[t] == c*y[t]\[DifferentialD]t +
e[t]*\[DifferentialD]t + σ*y[t]*w[t]},
y[t], {y, y0}, t, Distributed[w, WienerProcess[]]]


How do I now tell Mathematica that e[t] is a gaussian white noise process, c is a scalar and σ a non-negative scalar?

• Did you try searching the Internet for related problems ? – Sektor Aug 7 '15 at 14:01
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful – Michael E2 Aug 7 '15 at 14:02

Revision to accommodate multiple random processes

One approach is to define e[t] in the question as e*\[DifferentialD]w[t], with e a scale factor.

Then, ItoProcess yields

proc = ItoProcess[{\[DifferentialD]y[t] == c*y[t]*\[DifferentialD]t + σ*y[t]
*\[DifferentialD]w1[t] + e*\[DifferentialD]w2[t]}, y[t], {y, y0}, t,
{w1 \[Distributed] WienerProcess[], w2 \[Distributed] WienerProcess[]}]


or, equivalently,

proc = ItoProcess[{\[DifferentialD]y[t] == y[t]*\[DifferentialD]w1[t] +
\[DifferentialD]w2[t]}, y[t], {y, y0}, t,
{w1 \[Distributed] WienerProcess[c, σ], w2 \[Distributed] WienerProcess[0, e]}]

(* ItoProcess[{{c y[t]}, {{σ y[t], e}}, y[t]}, {{y}, {y0}}, {t, 0}] *)


A typical result can be obtained by specifying the four parameters.

SeedRandom[1236];
ans = RandomFunction[proc /. {σ -> 0.1, y0 -> 1, c -> -0.01, e -> 0.1}, {0, 100, .1}];
ListLinePlot[ans, Filling -> Axis, PlotRange -> All, AxesLabel -> {t, y}]


Note that SeedRandom is included only to obtain this particular curve and otherwise is unnecessary.

• If I do this, are the first w[t] and second w[t] then independent or one and the same process? Are you sure that all constants have to be given numerical values? I have examples notebooks where this is not the case and they work just fine. – Julian Karch Aug 10 '15 at 13:00
• @JulianKarls You are correct that giving all constants numerical values is not needed to define an ItoProcess but only to obtain numerical results. Also, I have revised the answer above to introduce a second WienerProcess to represent e(t). Thanks for prompting me to be more careful. – bbgodfrey Aug 10 '15 at 15:33
• Great, this has solved putting the process into mathematica. Is there a function that gives me the analytic expression for $y(t)$? – Julian Karch Aug 10 '15 at 19:13
• @JulianKarls There is no analytic expression for y[t], because it is stochastic. However, you can obtain its average value from Mean[proc[t]], which is E^(c t) y0. If the answer above meets you needs, please do not forget to accept it. Best wishes. – bbgodfrey Aug 10 '15 at 20:28
• y[t] being stochastic does not mean that there does not exist an analytic expression for it. The Ornstein-Uhlenbeck process for example is represented by a very similar SDE and there exists an analytic expression for it. – Julian Karch Aug 10 '15 at 21:05