# How to plot stability region of Fourier analysis

Stability limits for Runge–Kutta methods in the complex ΩΔt-plane are needed to be plotted like this:

For example, let P=1+z where z is complex. Under the stability condition |P|<=1, the plot line should be that of RK-1 in the given plot. Similarly, if P=1+z+1/2*z^2, then when |P|<=1 the plotting line is the corresponding of RK-2.

I am trying to code P=1+z like this:

Clear[yRe, yIm, w, NP, k, ϕ]
a = 1;
zexp = a*(Cos[ϕ] + I*Sin[ϕ]) + 1
xp[ϕ_Real, a_Real] = Abs@zexp*Cos[ϕ];
yp[ϕ_Real, a_Real] = Abs@zexp*Sin[ϕ]
NP = 30;
For[k = 1, k <= NP, k++,
w = 2.*Pi*(k - 1)/NP;
yRe[k] = xp[ϕ, a] /. {ϕ -> w};
yIm[k] = yp[ϕ, a] /. {ϕ -> w};
]
yRe = Table[yRe[k], {k, 1, NP}];
yIm = Table[yIm[k], {k, 1, NP}];
pointsz = Transpose[{yRe, yIm }];

pic1 = ListPlot[pointsz, AxesOrigin -> {0, 0},
PlotStyle -> Directive[Thick, Black, PointSize[Large]],
AxesStyle -> Directive[Black, 15],
AxesLabel -> {"Re(ωΔt)",
"Im(ωΔt)"}, AspectRatio -> Automatic]


The resulted plot as following is not correct. The truth is like RK-1 in the above figure.

How can i get the correct plot lines of RK-1 and RK-2 using Mathematica? Thanks.

Want to plot a region defined by an inequality? Just use RegionPlot.

z = x + I y;
p1 = 1 + z;
p2 = 1 + z + 1/2 z^2;
RegionPlot[{Abs[p1] <= 1, Abs[p2] <= 1}, {x, -2.5, 0.5}, {y, -2, 2},
AspectRatio -> Automatic]


If you just want the boundary contours, use ContourPlot[{Abs[p1] == 1, Abs[p2] == 1}, ... instead.

Oh hey check it out:

p[z_, n_] := Normal@Series[Exp[w], {w, 0, n}] /. w -> z;
ContourPlot[Evaluate@Table[Abs[p[x + I y, n]] == 1, {n, 1, 5}],
{x, -4, 1}, {y, -4, 4}, AspectRatio -> Automatic, Frame -> False, Axes -> True]


• Thanks Rahul Narain. That is what I want. Jul 31 '14 at 12:54