MathGroup Archive 2000

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

Search the Archive

Re: Weird Plot behavior...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22295] Re: Weird Plot behavior...
  • From: Jan Krupa <krupa at alpha.sggw.waw.pl>
  • Date: Wed, 23 Feb 2000 01:01:27 -0500 (EST)
  • Organization: http://news.icm.edu.pl/
  • References: <88sn7o$ioh@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

dougmckee at my-deja.com wrote:

> I'm getting some strange, seemingly incorrect
> graphs from Mathematica 3:
>
> First I define a simple piecewise continuous
> function:
>
> sf[x_]:=If[x<(1/3),1-3 x,0.5 x - 1/6]
>
> Then I graph its 4th iterate on [0,1] (along with
> y=x):
>
> Plot[{sf[sf[sf[sf[x]]]],x},{x,0,1}]
>

 Try read description of Plot in help browser. Here is some part of it:
 Plot initially evaluates f at a number of equally spaced sample points
specified by PlotPoints. Then it uses an adaptive algorithm to choose
additional sample points, attempting to produce a curve in which the
bend between successive segments is less than MaxBend. It subdivides a
given interval by a factor of at most PlotDivision.
 You should realize that with the finite number of sample points used,
it is possible for Plot to miss features in your function. To check your
results, you should increase the setting for PlotPoints.

Try add the following option: PlotPoints->50 (30 or more, default is 25)

Plot[{sf[sf[sf[sf[x]]]],x},{x,0,1},PlotPoints->50]

and you'll see all 7 fixed points.

Actually Mathematica does not make exact graph only an approximated
(usually very very well approximated).


Jan

>
> It's missing some information; in particular, the
> graph only shows 5 fixed points when I know there
> are 7.  And when I graph it on [0,2], I _do_ get
> all 7 fixed points, and, yes, they're all on
> [0,1]:
>
> Plot[{sf[sf[sf[sf[x]]]],x},{x,0,2}]
>
> What's going on?  Why is the first graph
> incorrect, and the second correct?
>
> Plot[{sf[sf[sf[sf[x]]]],x},{x,0,1},PlotDivision-
> >5]
>
> And here, even though I think I'm setting the
> PlotDivision _lower_ than the default (20), I get
> the right graph!
>
> Doug
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



  • Prev by Date: Re: defining function on mathematica
  • Next by Date: Re: Saving as HTML -- Page width problems
  • Previous by thread: Re: Weird Plot behavior...
  • Next by thread: Saving as HTML -- Page width problems