Re: Manipulate a VectorFieldPlot3D
- To: mathgroup at smc.vnet.net
- Subject: [mg80652] Re: Manipulate a VectorFieldPlot3D
- From: Mathieu G <ellocomateo at free.fr>
- Date: Tue, 28 Aug 2007 02:09:27 -0400 (EDT)
- References: <faj4u1$8rp$1@smc.vnet.net> <fajnd3$pg7$1@smc.vnet.net>
Albert a =E9crit : > Hi, > >> I would like to 3D plot two time dependent fields E and B. >> I have two questions about the current state of my notebook: >> >> Why the options Axes and AxesLabel produce an error, while producing >> the expected behaviour (adding the axes label!) >> >> How can I have a Manipulate object that would allow me to scan over t= ime? > > The following code works for me. Since the generation of the plots is > somewhat lengthy I used the option ContinousAction->False for > Manipulate. As has already been explained in this group thath it seems > to be the best approach to define functions of the variables you want t= o > Manipulate. This way there is no need for explicit usage of Dynamic > anywhere... > > Clear["Global`*"] > <<PhysicalConstants` > Needs["VectorFieldPlots`"] > c=299792458;(*SpeedOfLight*) > \[Mu]=\[Pi]/2500000;(*VacuumPermeability*) > \[Epsilon]=8.854187817`*^-12;(*VacuumPermittivity*) > \[Omega]=1;(*Angular speed*) > p=1;(*Unit dipole moment*) > k=\[Omega]/c;(*Norm of the wave vector*) > r=Norm[{x,y,z}];(*Norm of the position vector*) > a=10; > Ex[t_]=(y^2+z^2) Cos[\[Omega] t-k r]-x y Sin[\[Omega] t-k r]; > Ey[t_]=(x^2+z^2) Sin[\[Omega] t-k r]-x y Cos[\[Omega] t-k r]; > Ez[t_]=z (x Cos[\[Omega] t-k r]+y Sin[\[Omega] t-k r]); > Bx[t_]=-z Sin[\[Omega] t-k r]; > By[t_]=z Cos[\[Omega] t-k r]; > Bz[t_]=x Sin[\[Omega] t-k r]-y Cos[\[Omega] t-k r]; > Manipulate[ > Column[{ > Row[{"time = ",t}], > Row[{ > Show[ > VectorFieldPlot3D[(\[Omega]^2 p/4 \[Pi] \[Epsilon] c^2 r^3) > {Ex[t],Ey[t],Ez[t]},{x,-a,a},{y,-a,a},{z,-a,a},VectorHeads->True], > Axes->True,AxesLabel->{x,y,z},PlotLabel->"E",ImageSize->300 > ], > Show[ > VectorFieldPlot3D[(\[Mu] \[Omega]^2 p/4 \[Pi] c r^2) > {Bx[t],By[t],Bz[t]},{x,-a,a},{y,-a,a},{z,-a,a},VectorHeads->True], > Axes->True,AxesLabel->{x,y,z},PlotLabel->"B",ImageSize->300 > ] > }] > }], > {t,0,100}, > ContinuousAction->False > ] > > For this case I probably would prefer to visualize the time dependency > with something like: > > With[{c1 = (\[Omega]^2 p/4 \[Pi] \[Epsilon] c^2 r^3), > c2 = (\[Mu] \[Omega]^2 p/4 \[Pi] c r^2)}, > graphlist = Table[ > PrintTemporary[t]; > Column[{ > Row[{"time = ", t}], > Row[{ > Show[ > VectorFieldPlot3D[ > c1 {Ex[t], Ey[t], Ez[t]}, {x, -a, a}, {y, -a, a}, {z, -a, > a}, VectorHeads -> True], Axes -> True, > AxesLabel -> {x, y, z}, PlotLabel -> "E", ImageSize -> 300, > PlotRange -> {{-a, a}, {-a, a}, {-a, a}} > ], > Show[ > VectorFieldPlot3D[ > c2 {Bx[t], By[t], Bz[t]}, {x, -a, a}, {y, -a, a}, {z, -a, > a}, VectorHeads -> True], Axes -> True, > AxesLabel -> {x, y, z}, PlotLabel -> "B", ImageSize -> 300, > PlotRange -> {{-a, a}, {-a, a}, {-a, a}} > ] > }] > }], > {t, 0, 100, 10} > ] > ]; > > ListAnimate[graphlist] > > hth, > > albert > It works great and allowed to understand a couple of things with Mathematica! Thank you