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

MathGroup Archive 2001

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

Search the Archive

Re: Plot[f[x], {x,a,b}] Not Reaching End Points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29061] Re: Plot[f[x], {x,a,b}] Not Reaching End Points
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 26 May 2001 21:53:56 -0400 (EDT)
  • References: <9ekt3k$7td@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"aes" <siegman at stanford.edu> wrote in message
news:9ekt3k$7td at smc.vnet.net...
> When I execute
>
>       n=0.1;   Plot[ (1-x)^n, {x,0,1} ]
>
> the plot stops well short of dropping all the way to the baseline on the
> steeply falling edge as x approaches 1 --- even if I use PlotRange->All
> or expand to something unreasonable like PlotPoints->10000.


This is because for Plot[ (1-x)^n, {x,0,1} ] the initial sample points
nearly equally spaced from just greater than 0 to just less than 1.

The following shows the first and last points on the line.

n = 0.1; gr = Plot[(1 - x)^n, {x, 0, 1},
    PlotRange -> All, AxesOrigin -> {0, 0}];
InputForm[Cases[gr, Line[p_] -> p, Infinity][[1,{1, -1}]]]

{{4.166666666666666*^-8, 0.9999999958333332},
 {0.9999999583333333, 0.18280112991676942}}

n = 0.1; gr = Plot[(1 - x)^n, {x, 0, 1},
    PlotRange -> All, AxesOrigin -> {0, 0},
    PlotPoints -> 1000];
InputForm[Cases[gr, Line[p_] -> p, Infinity][[1,{1, -1}]]]

{{1.001001001001001*^-9, 0.9999999998998998},
 {0.999999998998999, 0.12590513670585798}}

To include the ends we can use Table to construct the sample points.

Show[Graphics[Line[Table[{x, (1 - x)^n},
     {x, 0, 1, 0.01}]]], Axes -> True,
  AxesOrigin -> {0, 0}, PlotRange -> All]

--
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




  • Prev by Date: Re: Showing intermediate steps in calculations
  • Next by Date: Re: Printing in Boldface
  • Previous by thread: Re: Plot[f[x], {x,a,b}] Not Reaching End Points
  • Next by thread: RE: Plot[f[x], {x,a,b}] Not Reaching End Points