kod programu

Transkrypt

kod programu
In[81]:=
In[84]:=
In[86]:=
In[89]:=
In[93]:=
In[94]:=
In[95]:=
In[96]:=
m = 0; n = 2;
lambda = 3;
kz = 2 * Pi  lambda;
alpha = BesselJZero@m , n D  N ;
omega = Sqrt@kz ^ 2 + alpha ^ 2D; T = 2 * Pi  omega;
r = Sqrt@x ^ 2 + y ^ 2D;
f = ArcTan @x , y D;
phi = m * f + kz * z - omega * t;
Ez = BesselJ @m , alpha * r D * Exp@I * phiD;
Ex = I * kz  alpha ^ 2 * D@Ez, x D;
Ey = I * kz  alpha ^ 2 * D@Ez, y D;
EE@x_ , y_ , z_ , t_ D = Re @Ex D ^ 2 + Re @Ey D ^ 2 + Re @EzD ^ 2;
Emax = Table @EE@x , 0, 0, ttD, 8x , 0.001, 1, 0.01<, 8tt, 0.01, T , 0.1 * T <D  Max ;
rys1@t_ D := DensityPlot@If@r < 1, EE@x , y , 0, tD, 0D, 8x , - 1, 1<, 8y , - 1, 1<,
PlotPoints ® 50, ColorFunction ® H ColorData@"SunsetColors"D@ð1  Emax D &L,
ColorFunctionScaling ® False , Frame ® None , PlotRange ® AllD
rys2@t_ D := DensityPlot@EE@0, y , z - 1, tD, 8z, 1, 4<, 8y , - 1, 1<,
PlotPoints ® 50, ColorFunction ® H ColorData@"SunsetColors"D@ð1D &L,
Frame ® None , AspectRatio ® 1  3, PlotRange ® AllD
legend = GraphicsB
: TextB Style B"mod TM " <> ToString @m D <> ToString @n D <> " wartosc ÈE
2
", Large F, 81.8, 1.1<F,
Arrow @88- 1.1, - 1<, 8- 1.1, 1<<D, Arrow @88- 1, - 1.1<, 80.95, - 1.1<<D,
Arrow @881.05, - 1.1<, 84, - 1.1<<D, Text@Style @"x ", Large D, 80, - 1.2<D,
Text@Style @"y ", Large D, 8- 1.2, 0<D, Text@Style @"z", Large D, 82.5, - 1.2<D,
White , Thick , Line @881, - 1<, 81, 1<<D, Circle @80, 0<, 1D> F;
rys3@t_ D := Show @rys1@tD, rys2@tD, legend , PlotRange ® 8All, 8- 1.3, 1.3<<,
Frame ® None , AspectRatio -> 0.5, ImageSize ® 800D;
In[98]:=
str @x_ D := StringReplacePart@"0000", x , 85 - StringLength @x D, 4<D
imax = 20;
Do@tt = 0.5 * T * i  imax ; Export@str @ToString @iDD <> ".gif", rys3@ttD, "GIF"D, 8i, 0, imax <D;