Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear[x]; Clear[y];
- x[0][t_] := Sin[2 Pi t];
- y[0][t_] := Cos[2 Pi t];
- \[Rho] = 0.9;
- n = 10;
- T = n + 2;
- \[Epsilon] = 10^-3;
- NormedVectorX[{x_, y_}] :=
- If[Norm[{x, y}] > \[Epsilon], x/Norm[{x, y}], x];
- NormedVectorY[{x_, y_}] :=
- If[Norm[{x, y}] > \[Epsilon], y/Norm[{x, y}], y];
- eqns = Flatten@Table[
- {
- x[i][0] == 0, y[i][0] == 0,
- D[x[i][t], t] ==
- If[t > i, 2 Pi, 0] \[Rho] ^
- i NormedVectorX[( {x[i - 1][t], y[i - 1][t]} - {x[i][t],
- y[i][t]})],
- D[y[i][t], t] ==
- If[t > i, 2 Pi, 0] \[Rho] ^
- i NormedVectorY[( {x[i - 1][t], y[i - 1][t]} - {x[i][t],
- y[i][t]})]
- }
- , {i, n}];
- soln = NDSolve[eqns, Flatten@Table[{x[i], y[i]}, {i, n}], {t, 0, T}];
- dt = 0.01;
- Manipulate[
- Graphics[{
- Thickness[Medium],
- Table[
- {ColorData["RedBlueTones"][i/n],
- Line[Table[{x[i][t], y[i][t]}, {t, 0, tmax, 0.01}]]}
- , {i, 0, n}],
- PointSize[Medium],
- Table[
- {
- Darker@ColorData["RedBlueTones"][i/n],
- Point[{x[i][tmax], y[i][tmax]}]},
- {i, 0, n}]
- } /. soln, PlotRange -> 1, ImagePadding -> 5]
- ,
- {{tmax, T}, 0.01, T, dt}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement