Re: Manipulate a VectorFieldPlot3D

• To: mathgroup at smc.vnet.net
• Subject: [mg80507] Re: Manipulate a VectorFieldPlot3D
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Thu, 23 Aug 2007 06:27:17 -0400 (EDT)
• Organization: Uni Leipzig
• References: <faj4u1\$8rp\$1@smc.vnet.net>

```Hi,
<< 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*)
t = 10;(*Time*)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[GraphicsRow[{
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}],
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}]}], {{t,
0}, 0, 100}
]

may help.

Regards
Jens
Mathieu G wrote:
> Hello,
> 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 time?
>
> Mathieu
>
>
>
>
> 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*)
> t = 10;(*Time*)
> a = 10;
>
> Slider[Dynamic[t],{0,100}]
>
> Ex = (y^2 + z^2) Cos[\[Omega] Dynamic[t] - k r] - x y Sin[\[Omega]
> Dynamic[t] - k r];
> Ey = (x^2 + z^2) Sin[\[Omega] Dynamic[t] - k r] - x y Cos[\[Omega]
> Dynamic[t] - k r];
> Ez = z (x Cos[\[Omega] Dynamic[t] - k r] + y Sin[\[Omega] Dynamic[t] - k
> r]);
>
> Bx = -z Sin[\[Omega] Dynamic[t] - k r];
> By = z Cos[\[Omega] Dynamic[t] - k r];
> Bz = x Sin[\[Omega] Dynamic[t] - k r] - y Cos[\[Omega] Dynamic[t] - k r];
>
> VectorFieldPlot3D[
>    (\[Omega]^2 p / 4 \[Pi] \[Epsilon] c^2 r^3) {
>      Ex, Ey, Ez
>      }
>    , {x, -a, a}, {y, -a, a}, {z, -a, a}
>    , Axes -> True
>    , AxesLabel -> {x, y, z}
>    ]
>
> VectorFieldPlot3D[
>    (\[Mu] \[Omega]^2 p / 4 \[Pi] c r^2) {
>      Bx, By, Bz
>      }
>    , {x, -a, a}, {y, -a, a}, {z, -a, a}