kod programu
Transkrypt
kod programu
m = 1; n = 1; lambda = 3; kz = 2 * Pi lambda; Off@General::"obspkg "D; << BesselZeros.m alpha = BesselJPrimeZeros@m , n D Last; 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; Bz = BesselJ @m , alpha * r D * Exp@I * phiD; Ex = I * omega alpha * D@Bz, x D; Ey = I * omega alpha * D@Bz, y D; EE@x_ , y_ , z_ , t_ D = Re @Ex D ^ 2 + Re @Ey D ^ 2; Emax = Table @EE@x , 0, 0, ttD, 8x , 0.001, 1, 0.01<, 8tt, 0, 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 , PlotRange ® All, AspectRatio ® 1 3D legend = GraphicsB : TextB Style B"mod TE" <> 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; 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;