Re: parametric plot extremely slow
- To: mathgroup at smc.vnet.net
- Subject: [mg90668] Re: parametric plot extremely slow
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 18 Jul 2008 04:03:12 -0400 (EDT)
- References: <g5n413$s7j$1@smc.vnet.net>
Christina,
Using the Presentations package, this can all be plotted directly in the
complex plane. Also, we can better see what is happening if we draw the
curves separately with different t domains. For example, there is no
necessity to plot around the circle 1000 times. It also helps if we see what
each of the functions looks like as a complex function of z. We don't really
need your cx and cy functions. We could either draw a Circle, or just for
fun use the complex expression for a circle.
Needs["Presentations`Master`"]
a1 = 2/3 E^((I \[Pi])/4);
a2 = 2/5 E^((I 4 \[Pi])/5);
z0[t_] = (Exp[I*0*Pi/4]*t - Abs[a1])/(Exp[I*0*Pi/4]*t*Abs[a1] - 1)*
a1/(Abs[a1]) // Simplify
((-1)^(1/4) (-2 + 3 t))/(-3 + 2 t)
z1[t_] = (Exp[I*2*Pi/4]*t - Abs[a1])/(Exp[I*2*Pi/4]*t*Abs[a1] - 1)*
a1/(Abs[a1]) // Simplify
((-1)^(1/4) (2 I + 3 t))/(3 I + 2 t)
z2[t_] = (Exp[I*4*Pi/4]*t - Abs[a1])/(Exp[I*4*Pi/4]*t*Abs[a1] - 1)*
a1/(Abs[a1]) // Simplify
((-1)^(1/4) (2 + 3 t))/(3 + 2 t)
z3[t_] = (Exp[I*6*Pi/4]*t - Abs[a1])/(Exp[I*6*Pi/4]*t*Abs[a1] - 1)*
a1/(Abs[a1]) // Simplify
((-1)^(1/4) (-2 I + 3 t))/(-3 I + 2 t)
Draw2D[
{Directive[Black, Thick],
ComplexCurve[Exp[I 2 \[Pi] t], {t, 0, 1}],
Directive[Red, Thin],
ComplexCurve[z0[t], {t, 0, 1}],
Blue,
ComplexCurve[z1[t], {t, 0, 100}],
Magenta,
ComplexCurve[z2[t], {t, .05, 100}],
Purple,
ComplexCurve[z3[t], {t, 0, 100}]},
Frame -> True,
PlotRange -> All,
ImageSize -> 400]
We obtain a better idea of what is happening by slightly restricting the
domain of the various z functions. This plot evaluates practically
instantaneously. There was no need to go to a high number of PlotPoints, or
a high MaxRecursion.
--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
"Cristina Ballantine" <cballant at holycross.edu> wrote in message
news:g5n413$s7j$1 at smc.vnet.net...
> Hi,
>
> I am working on a project involving many parametric plots and Mathematica
> 6 is extremely slow. The plot below takes about 5 minutes. I also need
> plots coloring regions with specific colors depending on the plotted
> point. They take about two hours.
>
> Any hints on increasing plot speed are very much appreciated. I am new to
> Mathematica and I cannot use Version 5 for Graphics. The plot below takes
> less than 10 seconds in other systems (but but they cannot be used for the
> more complicated region plots).
>
> Here is the code I used for the plot.
>
>
> a1 := 2/3*Exp[I*Pi/4]
> a2 := 2/5 Exp[I*4*Pi/5]
>
> zr0[t_] :=
> Re[(Exp[I*0*Pi/4]*t - Abs[a1])/(Exp[I*0*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zr1[t_] :=
> Re[(Exp[I*2*Pi/4]*t - Abs[a1])/(Exp[I*2*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zr2[t_] :=
> Re[(Exp[I*4*Pi/4]*t - Abs[a1])/(Exp[I*4*Pi/4]*t*Abs[a1] - 1)*a1/(Abs[a1])]
>
> zr3[t_] :=
> Re[(Exp[I*6*Pi/4]*t - Abs[a1])/(Exp[I*6*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zr0[t_] :=
> Re[(Exp[I*0*Pi/4]*t - Abs[a1])/(Exp[I*0*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zi1[t_] :=
> Im[(Exp[I*2*Pi/4]*t - Abs[a1])/(Exp[I*2*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zi2[t_] :
> Im[(Exp[I*4*Pi/4]*t - Abs[a1])/(Exp[I*4*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zi3[t_] :=
> Im[(Exp[I*6*Pi/4]*t - Abs[a1])/(Exp[I*6*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
> zi0[t_] :=
> Im[(Exp[I*0*Pi/4]*t - Abs[a1])/(Exp[I*0*Pi/4]*t*Abs[a1] -
> 1)*a1/(Abs[a1])]
>
>
> cx[t_] := Sin[t*2*Pi]
> cy[t_] := Cos[t*2*Pi]
>
> plotbasic :=
> ParametricPlot[{{cx[t], cy[t]}, {zr0[t], zi0[t]}, {zr1[t],
> zi1[t]}, {zr2[t], zi2[t]}, {zr3[t], zi3[t]}}, {t, 0, 1000},
> PlotRange -> 6, PlotPoints -> 150, MaxRecursion -> 10,
> PlotStyle -> {{Black, Thick}, Red, Blue, Magenta, Purple},
> PerformanceGoal -> "Speed" ]
>
> Show[plotbasic]
>
>
> Thank you in advance for your help.
>
> Best wishes,
>
> Cristina
>