Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2014

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: plotting complex functions in (x,y,t) space

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132150] Re: plotting complex functions in (x,y,t) space
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Fri, 3 Jan 2014 04:43:07 -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: <20131006074734.D77A66A1D@smc.vnet.net>

I recommend a different approach. Plot contours of the magnitude with the
coloring set by the argument.


psin[x_, xi_, y_, yi_, t_, ti_, kx_, ky_] =
  (20 E^(1/2 I kx (-kx (t - ti) + 2 (x - xi)) +
        1/2 I ky (-ky (t - ti) + 2 (y - yi)) -
        ((-kx (t - ti) + (x - xi))^2 +
           (-ky (t - ti) + (y - yi))^2)/
         (1600 + 2 I (t - ti))) Sqrt[2/=F0])/
   (800 + I (t - ti));


f[x_, y_, t_] =
  psin[x, 0, y, 0, t, 0, 2/10, 2/10];


The magnitude of f is given by


absf[x_, y_, t_] = ComplexExpand[Abs[f[x, y, t]],
  TargetFunctions -> {Re, Im}]


(20*E^(-((1600*(-(t/5) + x)^2)/(2560000 + 4*t^2)) -
           (1600*(-(t/5) + y)^2)/(2560000 + 4*t^2))*Sqrt[2/Pi])/
   Sqrt[640000 + t^2]


The minimum magnitude is close to zero.


magMin = With[{
   xmin = -125, ymin = -125, tmin = 0,
   xmax = 200, ymax = 200, tmax = 200},
  Minimize[{absf[x, y, t],
      xmin <= x <= xmax, ymin <= y <= ymax, tmin <= t <= tmax},
     {x, y, t}][[1]] // Simplify]


1/(20*E^50*Sqrt[2*Pi])


The maximum magnitude is


magMax = With[{xmin = -125, ymin = -125, tmin = 0,
   xmax = 200, ymax = 200, tmax = 200},
  Maximize[{absf[x, y, t],
      xmin <= x <= xmax, ymin <= y <= ymax, tmin <= t <= tmax},
     {x, y, t}][[1]] // Simplify]


1/(20*Sqrt[2*Pi])


The argument of f is


argf[x_, y_, t_] = ComplexExpand[Arg[f[x, y, t]],
   TargetFunctions -> {Re, Im}] // Simplify


Rewriting argf


argf2[x_, y_, t_] = Module[
   {z, p, q = (640000 + t^2)},
   z = (256000*(x + y) +
                t*(-51200 + x^2 + y^2))/(2*q);
   p = -(16*(2*t^2 - 10*t*
                    (x + y) + 25*(x^2 + y^2)))/q;
   ArcTan[(E^p*(800*Cos[z] + t*Sin[z]))/q,
      (E^p*((-t)*Cos[z] + 800*Sin[z]))/ q]];


Verifying that the expressions are the same


argf[x, y, t] == argf2[x, y, t]


True


The mnimum is determined numerically to be -Pi


argMin = With[{
   xmin = -125, ymin = -125, tmin = 0,
   xmax = 200, ymax = 200, tmax = 200},
  NMinimize[{argf[x, y, t],
     xmin <= x <= xmax, ymin <= y <= ymax, tmin <= t <= tmax},
    {x, y, t}][[1]]]


-3.14159


And the maximum is Pi


argMax = With[{
   xmin = -125, ymin = -125, tmin = 0,
   xmax = 200, ymax = 200, tmax = 200},
  NMaximize[{argf[x, y, t],
     xmin <= x <= xmax, ymin <= y <= ymax, tmin <= t <= tmax},
    {x, y, t}][[1]]]


3.14159


Use Manipulate to vary the magnitude of the contour. This is quite slow due
to the complexity of the functions involved.


With [{step = (magMax - magMin)/100.},
 Manipulate[
  ControlActive[
   (c - magMin)/(magMax - magMin),
   Module[{
     xmin = -125., ymin = -125., tmin = 0.,
     xmax = 200., ymax = 200., tmax = 200.},
    ContourPlot3D[absf[x, y, t] == c,
     {x, xmin, xmax}, {y, ymin, ymax}, {t, tmin, tmax},
     ColorFunction -> Function[{x, y, t, p},
       Hue[(argMax - argf2[x, y, t])/(argMax - argMin)]],
     ColorFunctionScaling -> False]]],
  {{c, magMin + step, "Abs[f[x,y,t]]"},
   magMin + step, magMax - step, step,
   Appearance -> "Labeled"}]]


Bob Hanlon

On Sat, Dec 21, 2013 at 2:29 PM, Michael B. Heaney <mheaney at alum.mit.edu>wr=
ote:

> Hi Bob,
>
> Thanks again for your help. I have modified your code a little, see below=


  • Prev by Date: Re: Step-By-Step Solutions No Longer working?
  • Next by Date: Re: For 2014?
  • Previous by thread: Re: Step-By-Step Solutions No Longer working?
  • Next by thread: Re: For 2014?