# Applying NDSolveValue on a differential equation

I am trying to solve stochastic Schrodinger equation (Schrodinger equation in the presence of Ornstein Uhlenbeck Process) $$i\frac{d}{dt}\begin{pmatrix}c_1(t)\\ c_2(t)\end{pmatrix}=H(t)\begin{pmatrix}c_1(t)\\ c_2(t)\end{pmatrix},$$

with

$$H(t) = \begin{bmatrix} h_1+v t+f(t)- \cos(k) & -i \sin(k) \\ i \sin(k) & -h_1-v t-f(t)+\cos(k) \end{bmatrix}$$

where $$f(t)$$ is Ornstein Uhlenbeck Process with noise correlation $$\langle f(t)f(t')\rangle=\frac{\xi^2}{2\tau_n}e^{-|t-t'|/\tau_n}$$ in which $$\xi$$ is noise intensity and $$\tau_n$$ is noise characteristic time.

The parameters $$\xi=0.1$$, $$\tau_n=0.01$$, $$v=0.1$$, $$h_1=-50$$, $$h_2=0.5$$, the initial time $$t_1=0$$ and the final time is $$t_2=(h_2-h_1)/v$$. The initial values of $$c_1(t_1)=1$$ and $$c_2(t_1)=0$$.

I have solved the differential equation using NDSolveValue, and I want to obtain $$|c_2(t2)|^2$$. My code (please see blow) works. But the results I have obtained is very strange.

Although I have calculated $$|c_2(t)|^2$$ at $$t_2$$ for all $$k$$ and $$k$$ changes very slowly ($$k$$ step is very small $$dk/\pi=0.001$$) but $$|c_2(t)|^2$$ shows very fast oscillation and very large difference between two nearby $$k$$ (please see black dots in figure) while the noise is the same for all $$k$$.

Could you please help me to understand why $$|c_2(t)|^2$$ shows very fast oscillation. Is my result correct or my code has a problem?

$PreRead = (# /. s_String /; StringMatchQ[s, NumberString] && Precision@ToExpression@s == MachinePrecision :> s <> "50." &); Clear["Global*"]; L = 200; v = 0.1; h1 = -50; h2 = 0.5; xi = 0.1; tn = 0.01; t1 = 0.; t2 = (h2 - h1)/v; f = Interpolation[ Normal[RandomFunction[ OrnsteinUhlenbeckProcess[0, xi/tn, 1/tn, 0], {t1, t2, 0.01}]][[ 1]]]; For[m = 1, m <= L/2, m = m + 1, k = ((2 m - 1)*\[Pi])/L; {x, y} = NDSolveValue[{I*Derivative[1][c1][t] == 2*(h1 + v*t - Cos[k] + f[t])*c1[t] + 2*(-I*Sin[k])*c2[t], I*Derivative[1][c2][t] == 2*(I*Sin[k])*c1[t] + 2*(-h1 - v*t + Cos[k] - f[t])*c2[t], c1[t1] == 1, c2[t1] == 0}, {c1, c2}, {t, t1, t2}]; Pk22 = Norm[y[t2]]^2; Print[k," ",Pk22] ];  @Daniel Huber @Parsifal Dear Daniel and dear parsifal, I have used your comments Stochastic process: Understanding Ornstein Uhlenbeck Process , Continuous noise representation to construct the continuous noise function. I think you are expert in this field. I was wondering if you wold be able to let me know you idea and feedback. • I feel like sharing that I tend to avoid posts that include $PreRead =... (unless it's a question about $PreRead, perhaps) and ClearAll["Global*"] or other things that will affect my setup. My eyesight's not that great. It's irritating when I don't notice something like that. I spend time figuring out why things aren't working. Then it turns out because it's because something trashed the state of my session. And the time was spent on something pointless. I don't know how to sandbox ClearAll["Global*"] and the like. Commented Jul 26, 2023 at 16:16 ## 1 Answer The amplitude of random function f you use is too higher compare to 1. With less amplitude we have Clear["Global*"]; SeedRandom[1234]; L = 200; v = 0.1; h1 = -50; h2 = 0.5; xi = 0.1; tn = 0.01; t1 = 0.; t2 = (h2 - h1)/v; f = Interpolation[ Normal[RandomFunction[ OrnsteinUhlenbeckProcess[0, xi/tn, 1/tn, 0], {t1, t2, 0.01}]][[1]]]; eps=1/10;  Numerical solution Do[k = ((2 m - 1)*\[Pi])/L; {x[m], y[m]} = NDSolveValue[{I* c1'[t] == (h1 + v*t - Cos[k] + eps f[t])*c1[t] + (-I*Sin[k])* c2[t], I* c2'[t] == (I*Sin[k])*c1[t] + (-h1 - v*t + Cos[k] - eps f[t])* c2[t], c1[t1] == 1, c2[t1] == 0}, {c1, c2}, {t, t1, t2}];, {m, 1, L/2} ];  Visualization ListLinePlot[ Table[{((2 m - 1)*\[Pi])/L, Evaluate[Abs[y[m][t2]]^2]}, {m, 1, L/2}], PlotRange -> All, PlotStyle -> Red, Mesh -> All, AxesLabel -> {"k", "|\!$$\*SubscriptBox[\(c$$, $$2$$]\)\!$$\*SuperscriptBox[\(|$$, \ $$2$$]\)"}]  • Thank you so much for your comment. Could you please let me know why we should consider the amplitude of noise less than 1? As far as I know in the colored noise the amplitude of noise is not restricted and I have considered the amplitude of the noise 1, not very larger than 1. In theoretical calculation the noise intensity$\xi$and the noise characteristic time$\tau_n\$ (noise correlation) are important and the amplitude of noise does not appear in theoretical calculation. Commented Jun 21, 2023 at 14:06
• We have a deal with numerical computation, and not with theoretical model. In numerical computation the amplitude of noise should be restricted. Anyway, if you like you can increase eps` and check what happened with numerical solution. Commented Jun 21, 2023 at 15:10
• Dear Alex, thank yo so much for your instructive and valuable comments. Commented Jun 21, 2023 at 15:12
• @Radmehr You are welcome! Commented Jun 21, 2023 at 15:14