# Plot 2d-ItoProcess data in a plane

I am trying to simulate a simple 2d Ito SDE (randomly perturbed Hamiltonian system). Below is the code.

proc = ItoProcess[{\[DifferentialD]x[t] ==
v[t] \[DifferentialD]t,
\[DifferentialD]v[t] == -x[t] ((x[t])^2 - 1) \[DifferentialD]t +
Sqrt[2*0.01] \[DifferentialD]w[t]}
, {x[t],v[t]}, {{x, v}, {0.9, 0.7}}, t, w \[Distributed] WienerProcess[]];


Question: I would like to plot the output (x,v) in a 2d-plane. How does one do this?

I tried to use the following

path = RandomFunction[proc, {0., 15, 0.05}, 1]


but I do not understand how to generate a 2d object. I am more interested in looking at the full trajectory in the phase space (x,v-space) rather than evolution.

I am extremely grateful for any advice and help. I am new to these ideas and therefore apologise if this question is too stupid.

PS. The actual aim is to superimpose this random trajectory onto the level sets of the Hamiltonian $H(x,v)=0.5\, v^2+0.25\, (x^2-1)^2$ which drives the deterministic part of the SDE.

• ListPlot[path] ? – Sektor May 9 '15 at 16:06
• But that plots both x and v separately. I want to plot the coordinate (x,v) in a plane. – UPS May 9 '15 at 16:12
• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – Mahdi May 9 '15 at 17:15

You need to extract data from path=RandomFunction using part. The following gives {x,v} list:

pts = path[[2, 1, 1]]


Now you can plot pts in the plane:

ListPlot[pts, Frame -> True, FrameLabel -> {"x", "v"}] • Yes this works perfectly. Thank you very much. Just one question. What kind of data is [[2,1,1]] extracting exactly, or more specifically in what order? – UPS May 9 '15 at 17:23
• My pleasure! Assume path is a multidimensional matrix. You need to extract the right element form the matrix. Now if you try these one by one path[], path[[2,1]] and path[[2,1,1]], you see how data points are extracted from path. – Mahdi May 9 '15 at 17:27

Since path is a TemporalData object, you can also make use of its various "Properties"

SeedRandom
proc = ItoProcess[{\[DifferentialD]x[t] ==
v[t] \[DifferentialD]t, \[DifferentialD]v[t] == -x[t] ((x[t])^2 - 1)
\[DifferentialD]t + Sqrt[2*0.01] \[DifferentialD]w[t]}, {x[t],
v[t]}, {{x, v}, {0.9, 0.7}}, t, w \[Distributed] WienerProcess[]];

path = RandomFunction[proc, {0., 15, 0.05}, 1];

path["Properties"]


{"Part", "Path", "PathComponents", "PathCount", "PathFunction", "PathFunctions", "PathLengths", "Paths", "PathStates", "PathTimes", "Properties", "SliceData", "SliceDistribution", "StateDimensions", "States", "Times"}

ListPlot[path["States"]] ListLinePlot[path["States"], Mesh -> All] ParametricPlot[path["PathFunction"]@x, {x, 0, Max@path["Times"]},
AspectRatio -> 1/GoldenRatio] ListPlot[path["PathComponents"]] (* or ListPlot[path] *) Plot[path["PathFunction"]@x, {x, 0, Max@path["Times"]}] • Very detailed. Thank you very much. Helps a lot. – UPS May 9 '15 at 19:37
• @UPS, my pleasure. Welcome to mma.se. – kglr May 9 '15 at 19:40