I am asking how NDSolve can be used to solve the following differential equation,
What is the correct code to solve the following differential equation nummerically (oscillating particle with mass m, friction coefficient k, random white noise force randomForce)?
m*x''[t] + k*x'[t] - randomForce[t] == 0
with x[0] == 0; x'[0] == 0;
Here is my code which lacks the appropriate options an parameters, causing NDSolve to produce an error at the end.
m = 6.137*10^-10; (* in g *)
k = 9.2055*10^-10; (* in g/s *)
temperature = 600; (* in K *)
kB = 1.3806488*10^-16 (* in erg/K *)
stddev = Sqrt[2*k*temperature*kB]
1.23497*10^-11
whiteNoise = WhiteNoiseProcess[stddev];
randomForce[t_Real] := RandomVariate[whiteNoise[t]];
tmax = 50;
s = NDSolve[
{m*x''[t] + k*x'[t] - randomForce[t] == 0, x[0] == 0, x'[0] == 0}
, x, {t, 0, tmax}
];
NDSolve::mxst: Maximum number of 610327 steps reached at the point t == 0.11124384151728325`.
NDSolvekeeps the steps very small because the randomness makes the error estimate large. You could try options likeMethod -> {"FixedStep", Method -> "ExplicitEuler"}, StartingStepSize -> 10^-3, but you're probably better off with one of the stochastic solvers. (Well, that's my naive advice.) – Michael E2 Apr 10 '18 at 17:23NDSolvedoes not have solvers to integrate SDEs. "It's the wrong tool. Try something else." -- that's the answer to this Q. The suggestion in my comment seems to be the Euler–Maruyama method, but you didn't reply. The alternative seems to be to use the answer in the linked Q&A. If that answer is an unsatisfactory solution of this SDE, please explain. – Michael E2 Apr 11 '18 at 13:48