Re: animation of the PDE
- To: mathgroup at smc.vnet.net
- Subject: [mg132331] Re: animation of the PDE
- From: Любовь Тупикина <lyubov78 at gmail.com>
- Date: Tue, 11 Feb 2014 02:57:22 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <b2fc44751be24af4850802802e9aa585@DB3PR07MB089.eurprd07.prod.outlook.com>
Dear Alexei!
Thank you so much!
Yes, with this equation it works.
I did not put the equations because they are long.
Maybe I needed to include them into the module or something...
Here is my system:
eps := 1;
B0 := 1.2;
om := 0.4;
tet := 1.5;
k := 0.5;
c := 0.12;
psi[x[p], y[p], p] = 1 - Tanh[y/(Sqrt[
1 + k^2 (B0 + eps Cos[om p + tet])^2 (Sin[
k (x - c p)])^2]) - ((B0 + eps Cos[om p + tet]) Cos[
k (x - c p)]/
Sqrt[1 + k^2 (B0 + eps Cos[om p + tet])^2 (Sin[k (x - c p)])^2])]
%PDE, which I am solving and animating(*)
Animate[ParametricPlot[
Evaluate[{y[p], x[p]} /.
NDSolve[{D[psi[x[p], y[p], p], y[p]] = x'[p],
D[psi[x[p], y[p], p], x[p]] = y'[p], x[1] == -1,
y[1] == -1}, {y[p], x[p]}, {p, 1, Tp}]], {p, 1, Tp},
PlotRange -> {{-2, 2}, {-2, 2}}] /. Line -> Arrow, {Tp, 1, 30}]
But it doesn't make the animation of the trajectory x[p], y[p].
"Equation or list of equations expected instead of \
\!\(\*SuperscriptBox[\"x\", \"\[Prime]\",
MultilineFunction->None][p]\) in the first argument \
{\!\(\*SuperscriptBox[\"x\", \"\[Prime]\",
MultilineFunction->None][p]\),\!\(\*SuperscriptBox[\"y\", \"\[Prime]\",
MultilineFunction->None][p]\),x[1]==-1,y[1]==-1}"
%------------------------------------------------------------------------------------------------------
p.s.
Actually, I was focusing on trying to show
several solutions (without any animation) of this PDE (*) depending on the
initial conditions {x[1] == i, y[1] == j}, like in cycle:
For[i = 1, i < 10,
i++, {ParametricPlot[
Evaluate[{y[p], x[p]} /.
NDSolve[{D[psi[x[p], y[p], p], y[p]] = x'[p],
D[psi[x[p], y[p], p], x[p]] = y'[p], x[1] == i,
y[1] == i}, {y[p], x[p]}, {p, 1, Tp}]], {p, 1, Tp},
PlotRange -> {{-2, 2}, {-2, 2}}]}]
But it also gave me mistakes, some are like in first case:
NDSolve::deqn: "Equation or list of equations expected instead of
\!\(\*SuperscriptBox[\"x\", \"\[Prime]\",
MultilineFunction->None][p]\) in the first argument
{\!\(\*SuperscriptBox[\"x\", \"\[Prime]\",
MultilineFunction->None][p], \*SuperscriptBox[\"y\", \"\[Prime]\",
MultilineFunction->None][p], x[1] == 1, y[1] == 1\)}."
Can you please tell, if the second case is possible to visualise (I mean,
to make a loop through initial conditions).
Thank you very much!
2014-02-10 9:20 GMT+01:00 Alexei Boulbitch <Alexei.Boulbitch at iee.lu>:
> Hola!
>
> I was using Mathematica to visualise trajectories of x[p],y[p] depending
> on p.
> Is it possible?
>
> Talking about "it's simple
> to animate the parametric plot of them by using ParametricPlot inside
> Animate."
>
> But I cannot animate the NDSolve using ParametricPlot.
> Can you please tell me why I get errors like "NDSolve::dsvar:
> 1.0011952113073699` cannot be used as a variable. ":
>
> Animate[
> ParametricPlot[
> {Evaluate[{y[p], x[p]} /. sol =
> NDSolve[...some equation type D[f1[x[p],y[p],p] = -D[x[p], p],
> f2[x[p],y[p],p] = -D[y[p], p]
> x[1] == -1, y[1] == -1}, {y[p], x[p]}, {p, 1, Tp}]]},
> {p, 1, Tp}], {Tp, 1, 100}]
>
> Thank you!
>
> Hi, Ljuba,
>
> Your code has nothing wrong in it except that you kept it without a
> precise equation. Have a look at the code below.
> I have only written down a simple equation containing a focus into your
> code:
> x'[p] == -y[p] - x[p]^3,
> y'[p] == x[p] - y[p]^3
>
> The animation appears to be rather spectacular:
>
> Animate[
> ParametricPlot[
> Evaluate[{y[p], x[p]} /.
> NDSolve[{x'[p] == -y[p] - x[p]^3, y'[p] == x[p] - y[p]^3,
> x[1] == -1, y[1] == -1}, {y[p], x[p]}, {p, 1, Tp}]], {p, 1,
> Tp}, PlotRange -> {{-2, 2}, {-2, 2}}] /. Line -> Arrow, {Tp, 1,
> 30}]
>
> Try it. Have fun.
>
> Alexei
>
>
> Alexei BOULBITCH, Dr., habil.
> IEE S.A.
> ZAE Weiergewan,
> 11, rue Edmond Reuter,
> L-5326 Contern, LUXEMBOURG
>
> Office phone : +352-2454-2566
> Office fax: +352-2454-3566
> mobile phone: +49 151 52 40 66 44
>
> e-mail: alexei.boulbitch at iee.lu
>
>
>