1
$\begingroup$

I have an itoprocess such as:

ItoProcess[{\[DifferentialD]vx[t] == -vx[t]*\[DifferentialD]t + 
  2*\[DifferentialD]w[t], \[DifferentialD]x[t] == vx[t]*\[DifferentialD]t}, 
  x[t], {{x, vx}, {x0, 0}}, t, w \[Distributed] WienerProcess[]]

I want to simulate this process 10000 time by using RandomFunction. However, I need the initial value of x (x0) to be Normal distributed such as x0 = RandomVariate[NormalDistribution[0,1]]. But the ItoProcess in Mathematica doesn't support random initial condition.

Is there any method to solve this problem?

$\endgroup$
2
  • $\begingroup$ Just add the random initial condition to the whole curve after it was sampled? $\endgroup$ Commented May 16, 2018 at 18:51
  • $\begingroup$ Thank you for helping! I think it works for random X0, but sometimes I also want the initial velocity vx0 to be random, which may not be applicable. $\endgroup$ Commented May 17, 2018 at 6:25

2 Answers 2

2
$\begingroup$

Perhaps something like this would be helpful:

proc := With[{x0 = RandomVariate[NormalDistribution[0, 1]]},
  ItoProcess[
   {\[DifferentialD]vx[t] == -vx[t]*\[DifferentialD]t + 2*\[DifferentialD]w[t], \[DifferentialD]x[t] ==  vx[t]*\[DifferentialD]t},
   x[t], {{x, vx}, {x0, 0}}, t, w \[Distributed] WienerProcess[]]
 ]

then

With[{n = 350},
  TemporalData[Nest[Join[#, {RandomFunction[proc, {0, 29, 1}]}] &, {}, n]] // ListLinePlot
 ]

Blockquote

$\endgroup$
2
  • $\begingroup$ Thanks a lot for helping! Yesterday I also try to solve this by using the "Table" such as "TemporalData[Table[Randomfunction[ItoProcess[...{{x, vx}, {RandomVariate[NormalDistribution[0,1]], 0}}, t, ...],{0,3,0.001}],10000]]". I will try if the two method are both applicable! $\endgroup$ Commented May 17, 2018 at 6:31
  • $\begingroup$ You are welcome! I haven't tried what you are suggesting but it seems plausible that it would work in principle. Please note that the amount of data points you are generating is substantial and I have doubts whether either approach will be practical when time/memory considerations are taken into account (on an old machine the estimated time to make 10000 repetitions with the specified step is approx. 15 mins and 257MB in size); perhaps you should consider the suggestions in the comments and/or the other answers as viable alternatives for the volume of your data requirements $\endgroup$ Commented May 17, 2018 at 6:48
0
$\begingroup$

I think this is essentially what @HenrikSchumacher suggested:

nsim = 10; 
ito = RandomFunction[ItoProcess[{\[DifferentialD]vx[t] == -vx[t]*\[DifferentialD]t + 
  2*\[DifferentialD]w[t], \[DifferentialD]x[t] == vx[t]*\[DifferentialD]t},
  x[t], {{x, vx}, {x0, 0}}, t, w \[Distributed] WienerProcess[]], {0., 5., 0.01}]
ListLinePlot[ito /. x0 -> #] & /@RandomVariate[NormalDistribution[0, 1], nsim]

10 Ito realizations

Mean[ito /. x0 -> #] & /@RandomVariate[NormalDistribution[0, 1], nsim]
(* {0.264367, 0.555122, -1.45459, 0.663994, -3.19353, -0.383676, 0.51233, -1.1766, 
    1.54617, 1.6006} *)
$\endgroup$
1
  • $\begingroup$ Thanks a lot for helping! In my problem I need to derive the distribution of X at some fixed time. So I also have to use orders such as "["SliceData",t]". I will try if I can define the 10000 trajectories as a TemporalData by using your method. Thanks again! $\endgroup$ Commented May 17, 2018 at 6:37

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.