MathGroup Archive 2007

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

Search the Archive

Re: problem with contourplot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81871] Re: problem with contourplot
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 5 Oct 2007 04:54:51 -0400 (EDT)
  • References: <fe27r1$joh$1@smc.vnet.net>

Here is a solution using DrawGraphics. (Except this and other complex 
function graphics routines are still in a development notebook and not quite 
yet in DrawGraphics.)

First define the function as a complex function:

dispsqr[kl_][
  z_] := (1 + (1/
     kl)^2 (1 + (\[ImaginaryI] Sqrt[\[Pi]]
        z \[ExponentialE]^-(z/(Sqrt[2] kl))^2 (1 +
         Erf[(\[ImaginaryI] z)/(Sqrt[2] kl)]))/(Sqrt[2] kl)))^2

The following statement makes the plot:

With[
 {f = dispsqr[0.1],
  zmin = -2 - 1.0 \[ImaginaryI],
  zmax = 2 + 1.5 \[ImaginaryI],
  contourlist = {0, 0.001`, 0.01`, 0.05`, 0.15`, 0.25`, 0.4`, 1, 2, 4,
     10, 50, 400}},
 Draw2D[
  {ComplexCartesianContour[f[z], {z, zmin, zmax}, Abs,
    Contours -> contourlist,
    ColorFunctionScaling -> False,
    ColorFunction -> (ContourColors[contourlist,
         ColorData["ThermometerColors"]]),
    PlotPoints -> {25, 25},
    PlotRange -> {0, 400},
    ClippingStyle -> Gray]},
  Frame -> True, FrameLabel -> {Re, Im}, RotateLabel -> False,
  PlotLabel ->
   Row[{"Modulus of ", 0 < HoldForm[dispsqr[0.1][z]] < 400}],
  ImageSize -> 600]
 ]

ComplexCartesianContour accepts complex expressions and there is a single 
complex iterator. Any function producing real output, in this case Abs, can 
be applied to the function to produce the contours. ContourColors is a 
DrawGraphics routine that produces distinct colors for all contour regions 
no matter what the spacing of the contour values are.  The plot clearly 
shows all the contours. It is not necessary to use extended precision.

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"KLEIN Rudy" <Rudy.Klein at lpmi.uhp-nancy.fr> wrote in message 
news:fe27r1$joh$1 at smc.vnet.net...
> hello,
> I'm trying to contourplot a function with high gradients.
> this is my code:
>
> In > contoursLandau[kld_, contoursList_List, {rgX_, rgY_}] := 
> Module[{disp},
>
>   disp[kl_, z_] :=
>    SetPrecision[
>     1 + (1/kl)^2*(1 +
>         I*Sqrt[Pi]*(z/(Sqrt[2.]*kl))*
>          Exp[-(z/(Sqrt[2.]*kl))^2]*(1 + Erf[I*z/(Sqrt[2.]*kl)])),
>     100];
>
>   fonctionColoration=RGBColor[0, 0, #] &;
>
>   ContourPlot[
>    Abs[disp[kld, x + I y]]^2, {x, rgX // First, rgX // Last}, {y,
>     rgY // First, rgY // Last},
>    ColorFunction -> fonctionColoration, Contours -> contoursList,
>    PlotPoints -> 100]
>
>
>   ];
>
>
>
> In > contoursLandau[0.1, ({4, 1, 0.4, 0.25, 0.15, 0.05, 0.01, 0.001} //
> Reverse), {{-1.5, 1.5}, {0.5, -1.5}}]
>
>
> the problem is with the coloration of the plot: i'd like to Log-scale
> the contours and have for example:
>
> RGBColor[0,0.5,#]&/@Log[10, {4, 1, 0.4, 0.25, 0.15, 0.05, 0.01, 0.001}
> // Reverse] // Rescale
>
> but it doesn't work and i can't identifie the cause of the problem...
> thanks for help
>
> Rudy
>
>
>
>
>
>
>
>
> 



  • Prev by Date: Re: converting function from RasterArray to Raster
  • Next by Date: Re: How to help Mathematica take an integral
  • Previous by thread: problem with contourplot
  • Next by thread: Re: Re: problem with contourplot