Reza Malek-Madani

Phase Plane Using Stream Functions

This program plots the phase portrait of the
system of differential equations
x' = f(x,y), y' = g(x,y), 
when the right-hand side is given by a stream function. The program is written
for the stream function
psi = y - y/(x^2+y^2)
with initial positions 
(-3, 0.01), (-3, 0.05), (-3, 0.1), and (-3, 0.5) 
for the duration 0 < t < 3.

Here is the program:


tfinal = 5;
data={{-3,0.01}, {-3, 0.05}, {-3, 0.1}, {-3,0.5}};
psi =y - y/(x^2+y^2);
f[x_, y_] = D[psi, y]; g[x_, y_] = - D[psi, x];
eqns={x'[t]== f[x[t], y[t]], y'[t]==g[x[t], y[t]]};
(* *)
sol = Table[NDSolve[Flatten[{eqns, 
x[0] == data[[i,1]],
y[0] == data[[i,2]]}],
{x, y}, {t, 0, tfinal}, MaxSteps->10000], 
{i, 1, Length[data]}];
soll1 = Flatten[sol, 1];
output1 = ParametricPlot[Evaluate[{x[t], y[t]} /. soll1], {t, 0, tfinal},
DisplayFunction->Identity];
OutPut = Show[output1,DisplayFunction->$DisplayFunction];

Here is the output:

[Graphics:phasestreamgr2.gif][Graphics:phasestreamgr1.gif]
go to Top