Mathematica Asked on January 17, 2021
What is the cleanest/simplest way to use ItoProcess
to solve the equation
$$i text{d}boldsymbol{psi} = Hcdotboldsymbol{psi} text{d}t + boldsymbol{psi}^2text{d}t + text{d}mathbf{w},$$
where $H$ is a matrix, $boldsymbol{psi}$ is a vector, $mathbf{w}$ is a vector of random processes, and $boldsymbol{psi}^2$ denotes the element-wise square. The initial condition for $boldsymbol{psi}$ is known. Here is some initial code (but I’m looking for a general approach that treats any number of simultaneous differential equations)
ClearAll["Global`*"];
H = RandomComplex[{-1 - I, 1 + I}, {4, 4}];
H = H + ConjugateTranspose[H];
psi0 = RandomComplex[{-1 - I, 1 + I}, 4];
process = ItoProcess["???"];
sim = RandomFunction[process, {0, 10, 0.01}]
ListPlot[Re[sim]]
Here's a way I worked out how to do it. It's not pretty though.
ClearAll["Global`*"];
L = 4;
H = RandomComplex[{-1 - I, 1 + I}, {L, L}];
H = H + ConjugateTranspose[H];
psi0 = ConstantArray[0, L];
variables = Table[Unique["x"], {L}];
X[t_] = #[t] & /@ variables;
wVariables = Table[Unique["w"], {L}];
w[t_] = #[t] & /@ wVariables;
wiener = # [Distributed] WienerProcess[] & /@ (wVariables);
system = I [DifferentialD]X[
t][[#]] == ((H.X[
t])[[#]] [DifferentialD]t + [DifferentialD](w[
t])[[#]]) & /@ Range[L];
process = ItoProcess[system, X[t], {variables, psi0}, t, wiener];
sim = RandomFunction[process, {0, 10, 0.01}];
ListPlot[Abs[sim], Joined -> True]
Answered by Tom on January 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP