Re: Plotting Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg17687] Re: [mg17474] Plotting Problem
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 21 May 1999 23:59:03 -0400
- References: <7hg9mf$7u6$1@dragonfly.wolfram.com>
- Sender: owner-wri-mathgroup at wolfram.com
Adrzej,
Yes - thanks -
The explanation seems to be that in one cell
<<Statistics`ContinuousDistributions
Plot[PDF[NormalDistribution[0,1],x],{x,-2,2}]
is evaluated as one expression - apparently a product. And the rule is that
the
*symbols are constructed in the appropriate context before any evaluation*
(else how would the intended values be communicated?).
The result is that the full name of the symbols constructed from PDF and
NormalDistribution are Global`PDF and Global`NormalDistribution.
Then the package is loaded, and it is as if we evaluated the following
first in one cell
Plot[PDF[NormalDistribution[0,1],x],{x,-2,2}]
and then evaluated
<<Statistics`ContinuousDistributions
So that we get the usual shadowing - as is shown by the first two warning
messages.
We could, of course, recover by using
Remove[PDF, NormalDistribution]
But, clearly its better to avoid needing this by loading the package first.
Interestingly, even in a single cell,
Needs["Statistics`ContinuousDistributions"]
Plot[PDF[NormalDistribution[0,1],x],{x,-2,2}]
is regarded as two expression and so evalutes as we want.
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote in message
news:7hg9mf$7u6$1 at dragonfly.wolfram.com...
> There is no difference. I suspect you evaluated
> <<Statistics`ContinuousDistributions` and
> Plot[PDF[NormalDistribution[0,1],x],{x,-2,2}] inside the same cell. First
> evaluate <<Statistics`ContinuousDistributions` then in a new cell
> Plot[PDF[NormalDistribution[0,1],x],{x,-2,2}] and I am (almost) sure it
will
> work fine.
> --
> Andrzej Kozlowski
> Toyama International University
> JAPAN
> http://sigma.tuins.ac.jp
> http://eri2.tuins.ac.jp
>
>
> ----------
> >From: bcolletti at mail.utexas.edu (Bruce W. Colletti)
To: mathgroup at smc.vnet.net
> >To: mathgroup at smc.vnet.net
> >Subject: [mg17687] [mg17474] Plotting Problem
> >Date: Sun, May 9, 1999, 5:44 PM
> >
>
> > Re Mathematica 3.0 (Windows 95).
> >
> > In response to...
> >
> > <<Statistics`ContinuousDistributions`
> > Plot[PDF[NormalDistribution[0,1],x],{x,-2,2}]
> >
> > ...the message appears "plot: plnr: PDF[NormalDistribution[0,1],x] is
not
> > a machine-size real number at x = 0.1696...?"
> >
> > What am I doing wrong? Everything works well (a graph is produced) for:
> >
> > <<Statistics`ContinuousDistributions`
> > Plot[CDF[GammaDistribution[3,1],x],{x,0,10}]
> >
> >
> > Why does Mathematica fail to graph in one but not the other?
> >
> > Thanks.
> >
> > Bruce
> >
>
>
>