       Re: errors with contour plots

• To: mathgroup at christensen.cybernetics.net
• Subject: [mg1004] Re: errors with contour plots
• From: ianc (Ian Collier)
• Date: Mon, 8 May 1995 05:08:28 -0400
• Organization: Wolfram Research, Inc

```In article <3o6trh\$psn at news0.cybernetics.net>, blfishman at ucdavis.edu (Beth
Fishman (Schuyler)) wrote:

> please respond to me directly I use the web to read the list
>
> Again, I am trying to teach myself mathmatica and cannot figure out why I
> am getting a certain error message.  The notebook is attached.
>
> Any help learning mathmatica would be appreciated. I have several books,
> but when I finally try to do my own problems, I get lots of erros which I
> cannot decode
>
> thanks
>
> __________
> phi[x_,y_] := c f ( - y ( Cos[Pi[] p / 1000] + 1 ) + k^-1 Sin[k ( x - c t )])
> c = 1
> f = 10^-4
> p = 250
> k = 1
> t = 0
> 1
>   1
> -----
> 10000
> 250
> 1
> 0
> ContourPlot[phi[x,y], {x,0,Pi}, {y,0,Pi}]
> ContourPlot::plnr:
>    phi[x, y] is not a machine-size real number at {x, y}
>      = {0., 0.}.
>
> -ContourGraphics-
> -------------------------
>
> -------------------------------------------------------------------
> Beth Fishman (Schuyler)                 Dept of Atmospheric Science
> Graduate Student                        Land Air and Water Resources
> blfishman at ucdavis.edu                   Hoagland Hall
> 916-752-1868                            U.C. Davis
> http://atm21.ucdavis.edu/~fishman       Davis CA 95616
>
> "Practice senseless beauty and random acts of kindness"
> -------------------------------------------------------------------

Hello,

I think that the problem lies in your definition of phi[x_,y_].

The error message is telling you that it does not evaluate
to a real number at {x,y} = {0.,0.} and a whole lot of
other points.

phi[x_,y_] :=
c f ( - y ( Cos[Pi[] p / 1000] + 1 ) + k^-1 Sin[k ( x - c t )])
^^^^

The function Pi[] is not defined anywhere. So when ContourPlot
tries to evaluate phi[0.,0.] it gets the following:

In:=
phi[0.,0.]
Out=
Pi[]
0. + 0. (1 + Cos[----])
4
-----------------------
10000

and so on for other values of x and y.

There is no way of plotting this.

I suspect that this is a typo. When I changed Pi[] to Pi
the Mathematica name for the constant pi, it plotted
without error.

phi[x_,y_] :=
c f ( - y ( Cos[Pi p / 1000] + 1 ) + k^-1 Sin[k ( x - c t )])

I hope this helps.

--Ian

----------------------------------------------------------------
Ian Collier
Technical Sales Support
Wolfram Research, Inc.
----------------------------------------------------------------
Tel (217) 398-0700        Fax (217) 398-0747        ianc at wri.com