0

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`.

mrz
  • 11,686
  • 2
  • 25
  • 81
  • 1
    I don't know much about integrating random processes, but you might be interested in this guide. It seems NDSolve keeps the steps very small because the randomness makes the error estimate large. You could try options like Method -> {"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:23
  • 2
    Maybe you could clarify further what you're seeking. NDSolve does 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
  • 2
    I recommend taking a look at the documentation for Stochastic Differential Equation Processes: http://reference.wolfram.com/language/guide/StochasticDifferentialEquationProcesses.html – Sjoerd Smit Apr 11 '18 at 14:20
  • @Michael E2, Sjoerd Smit: Thank you for your helpfull comments. especially about: "NDSolve does not have solvers to integrate SDEs. "It's the wrong tool.". So I will read the content at your links thoroughly. – mrz Apr 12 '18 at 09:06

0 Answers0