求解随机微分方程

时间:2016-11-24 07:58:47

标签: wolfram-mathematica mathematical-optimization numeric numerical-methods stochastic

下面的代码用于在Mathematica中以数字方式求解一个粒子的随机方程。我想知道是否有一种方法可以将它推广到多个粒子的情况并且平均值超过它们。有谁知道怎么做?

Clear["Global`*"]
{ a = Pi, , b = 2 Pi, l = 5, k = 1};
ic = x@tbegin == 1;
tbegin = 1;
tend = 400;
interval = {1, 25};
lst := NestWhileList[(# + RandomVariate@TruncatedDistribution[interval, 
StableDistribution[1, 0.3, 0, 0, 1]]) &, tbegin, # < tend &];
F[t_] := Piecewise[{{k, Or @@ #}}, -k] &[# <= t < #2 & @@@ 
Partition[lst, 2]];
eqn := x'[t] == (F@(t)) ;
sol = NDSolveValue[{eqn, ic}, x, {t, tbegin, tend}, 
MaxSteps -> Infinity];

Plot[sol@t, {t, tbegin, tend}]
First[First[sol]]
Plot[sol'[t], {t, tbegin, tend}]
Plot[F[t], {t, tbegin, tend}]

0 个答案:

没有答案