1
$\begingroup$

I would like to compute the mean of s[t] which is given by the first equation in these coupled stochastic ordinary differential equation

p[y_, a_] := a/((1 + a)*(1 + 0.5*y)) 
q[m_] := q0/2*(1 + Tanh[(m - 0.05)/0.005]) 
q0 = 0.5;
 beta = 0.15;
 alpha = 0.15; 
gamma = .1; 
s0 = 0.038; 
sigma = 0.1; 
FF[t_] = alp (1 + Tanh[llSin[2*Pit/P0]]) /. {ll -> 10, P0 -> 1, alp -> 2}
F = ItoProcess[{
   \[DifferentialD]s[t] == ((2*p[y[t], a[t]] - 1)*s[t]  + 
        q[m[t]]*y[t]) \[DifferentialD]t + s[t]  \[DifferentialD]w1[t],
   \[DifferentialD]y[t] == (2*(1 - p[y[t], a[t]])*
         s[t]  - (0.2 (1 + FF[t]) + q[m[t]]) y[
          t]) \[DifferentialD]t + y[t] \[DifferentialD]w2[t],
   \[DifferentialD] a[t] == (a[t]*(beta*s[t]*a[t]/(1 + a[t]) -alpha)) \[DifferentialD]t + \[DifferentialD]w[t],
   \[DifferentialD]m[t] == (gamma*Exp[-s[t]/s0] - alpha*m[t]) \[DifferentialD]t},
  s[t], {{s, y, a, m}, {0.1, 0.1, 0.5, 0.1}}, t, 
  {w1 \[Distributed] WienerProcess[], 
   w2 \[Distributed] WienerProcess[], 
   w \[Distributed] WienerProcess[]}]

OO = RandomFunction[F , {0, 1, 0.01}, 8]
    ListLinePlot[OO , PlotRange -> All]

enter image description here

I want to compute the mean of these 8 curves could anybody help ? I tried Mean[OO[t]] but it does not give the answer

$\endgroup$
6
  • 1
    $\begingroup$ Please include the values of all the parameters so we can run your code. $\endgroup$
    – MarcoB
    Dec 9, 2020 at 15:38
  • $\begingroup$ Something like {Mean@OO["ValueList"]} // ListLinePlot $\endgroup$
    – chris
    Dec 9, 2020 at 15:41
  • $\begingroup$ or {OO["PathTimes"], Mean@OO["ValueList"]} //Transpose//ListLinePlot $\endgroup$
    – chris
    Dec 9, 2020 at 15:55
  • 1
    $\begingroup$ these are the parameters and functions:p[y_, a_] := a/((1 + a)*(1 + 0.5*y)) q[m_] := q0/2*(1 + Tanh[(m - 0.05)/0.005]) q0 = 0.5; beta = 0.15; alpha = 0.15; gamma = .1; s0 = 0.038; sigma = 0.1; FF[t_] = alp (1 + Tanh[llSin[2*Pit/P0]]) /. {ll -> 10, P0 -> 1, alp -> 2} $\endgroup$ Dec 9, 2020 at 16:36
  • $\begingroup$ @elKettaniPerla Please edit your question accordingly with parameters in your comment. $\endgroup$ Dec 9, 2020 at 17:28

1 Answer 1

2
$\begingroup$
proc = ItoProcess[{\[DifferentialD]x[t] == 
    v[t] \[DifferentialD]t, \[DifferentialD]v[
      t] == -x[t] \[DifferentialD]t + \[DifferentialD]n[t]}, 
  x[t], {{x, v}, {1, 0}}, t, n \[Distributed] WienerProcess[]]


path = RandomFunction[proc, {0., 2. Pi, 0.05}, 12, 
   Method -> "StochasticRungeKutta"];

pl1=ListLinePlot[path];

pl2 = {path["PathTimes"], Mean@path["ValueList"]} // Transpose // 
  ListLinePlot[#, PlotStyle -> AbsoluteThickness[4]] &;

Then

 Show[pl1,pl2]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.