Re: Plot bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg6365] [mg6365] Re: [mg6354] Plot bug?
- From: Richard Gass <gass at physics.uc.edu>
- Date: Fri, 14 Mar 1997 14:53:45 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Brad Miller wrote
>Hi,
> I am running the new version of mathematica (3.0), and some
>code that worked under the old version (2.x?) is not working.
>
>pseudo-mathematica session
>*****************************************************
>1> Needs["Statistics`ContinuousDistributions`"]
>
>2> PopRatio[pratio_]:=
> Module[{p}, p=CDF[NormalDistribution[0,1],pratio];
> - 2 pratio / Ln[(1-p)/p]
> ]
>
>3> Plot[PopRatio[x],{x,.000001,.7}]
>
>Errors: "Plot::plnr : PopRatio[pratio] is not a machine-size real
> number at pratio = 0.0283978535340494791"
> and many other points also say not a machine-size real number
>*****************************************************
>
>
>Doing a PopRatio[0.0283978535340494791] on the reported bad number
>produces the correct PopRatio return value - it does not blow up. So,
>I'm surmising the problem is in the Plot cmd?
>
>This exact fn worked in mathematica 2.x - result should be a plot from
>around 1.26 to 1.2 - there are no discontinuities in the plot.
>
>Any suggestions on how to get PopRatio to plot correctly?
>
The problem is the use of Ln for the natural log. Mathematica uses Log. If
you change Ln to Log and try
PopRatio[pratio_]:=
Module[{p}, p=CDF[NormalDistribution[0,1],pratio];
- 2 pratio / Log[(1-p)/p]
]
the function will work correctly.
Richard Gass
Department of Physics
University of Cincinnati
Cincinnati, OH 45221
phone- 513-556-0519
E-Mail gass at physunc.uc.edu