       How does Plot work?

• To: mathgroup at smc.vnet.net
• Subject: [mg115144] How does Plot work?
• From: Yaroslav Bulatov <yaroslavvb at gmail.com>
• Date: Sun, 2 Jan 2011 04:56:19 -0500 (EST)

```I've read the chapter in Stan Wagon's book on adaptive plotting, and I

1. How does Plot choose initial 50 points?
If they were chosen to split PlotRange into 49 equal intervals, then
the following Plot would coincide with x-axis, but it doesn't
kk = 49;
plot1 = Plot[Sin[2 Pi x], {x, 0, kk}, Mesh -> All, PlotStyle -> Gray,
MeshStyle -> Directive[Black, Thick], MaxRecursion -> 0,
PlotPoints -> kk + 1, PlotRangePadding -> 0,
PlotRange -> {{0, kk}, {-1, 1}}, Axes -> {True, True}]

2. How does adaptive plotting choose to subdivide the regions?
The explanation in the book is that it subdivides if the angle between
two segments is more than 5 degrees, but you can see in this sequence
below that a segment doesn't get subdivided, even it should be
according to the "5 degree rule". This recently caused a user to
wonder why there was a "hole" in his plot (http://stackoverflow.com/
questions/4572183/strange-sinx-graph-in-mathematica)

plot1 = Plot[Sin[x], {x, -42 Pi, 42 Pi}, PlotPoints -> 100,
PlotStyle -> LightGray];
Table[plot2 =
Plot[Sin[x], {x, -42 Pi, 42 Pi}, Mesh -> All, MeshStyle -> Thick,
PlotStyle -> Red, MaxRecursion -> k];
Show[plot1, plot2, PlotRange -> {{-110, -90}, {-1, 1}},
PlotLabel -> ("MaxRecursion " <> ToString[k])], {k, 0,
5}] // GraphicsColumn

```

• Prev by Date: Re: switching between versions 7 and 8
• Next by Date: Re: Home Edition limitations?
• Previous by thread: Re: switching between versions 7 and 8
• Next by thread: Re: How does Plot work?