1
$\begingroup$
h[x0_] := Module[{b = x0}, f[z_] := 2 z^2;
z[t_] := Cos[t] + I Sin[t];
w = ComplexExpand[f[z[t]]];
p1 = ParametricPlot[{Re[z[t]], Im[z[t]]}, {t, 0, b},PlotRange -> All, PlotStyle->{Red}];
p2 = ParametricPlot[{Re[w], Im[w]}, {t, 0, b}, PlotRange -> All, PlotStyle -> {Green}];
Show[p1, p2]]
Manipulate[h[p], {p, \[Pi]/10, 2 \[Pi], \[Pi]/10}]

We know that $f[z]:=2z^2$ represents a circle when $z$ moves from $0$ to $\pi$. Now, when $z$ moves from $\pi$ to $2\pi$, the function $f[z]$ takes one round of circle and complete the circle.

When the first round is completed by $f[z]$, the line continues to be shown in green color. I want $f[z]$ to change color when it starts on a new round.

Similarly, when it starts its third (or fourth and so on) round its color should change every time.

What can I do?

$\endgroup$
0
$\begingroup$

You need to specify a color function that changes every $2\pi$:

z[t_] := Cos[t] + I Sin[t];

Manipulate[
 ParametricPlot[
  {Re[z[t]], Im[z[t]]},
  {t, 0, tmax},
  ColorFunction -> Function[{x, y, u}, ColorData[97, Quotient[u, 2 Pi]]],
  ColorFunctionScaling -> False,
  PlotStyle -> Thickness[0.1]
  ],
 {tmax, 2 Pi, 10 Pi}
 ]

Example

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.