DiscretePlot

• To: mathgroup at smc.vnet.net
• Subject: [mg96697] DiscretePlot
• From: Helen Read <hpr at together.net>
• Date: Sat, 21 Feb 2009 19:38:39 -0500 (EST)

```I recently started the chapter on series in my Calculus II classes. I
like to have my students make tables and plots of terms and partial sums
of series, to help them develop some intuition about what it means for a
series to converge or diverge, which leads naturally into convergence
tests. (Give them something where it's hard to determine
convergence/divergence from tables and plots, and the students will
*ask* how can we know for sure.) Prior to Mathematica 7, we always had
to start with a table, name it something, and use ListPlot to plot it.
So now with Mathematica 7, I still have my students make some smallish
tables (I like them to have numbers to look at it in addition to plots),
but now we can plot directly with the new DiscretePlot. I like
DiscretePlot a lot, except for one complaint I will get to below.

As an example, consider the alternating harmonic series. My students
know how to define a function for the terms and a function to generate
the partial sums, then plot the terms or the partial sums with
DiscretePlot, like so.

a[n_] = (-1)^(n + 1)/n

s[k_] := Sum[a[n], {n, 1, k}]

DiscretePlot[s[k], {k, 1, 100},PlotLabel->"Partial sums"]

We can turn off the filling. (I like the filling sometimes, but not always.)

DiscretePlot[s[k], {k, 1, 100}, Filling -> None]

All well and good.

However, unlike ListPlot (which has Joined->False by default),
DiscretePlot has Joined->Automatic by default. If we plot greater than
149 points with DiscretePlot, Mathematica joins the points, and it's a
royal mess.

DiscretePlot[s[k], {k, 1, 149}, Filling -> None]  (* this is fine *)

DiscretePlot[s[k], {k, 1, 150}, Filling -> None]  (* this is a wreck *)

As another example, try using DiscretePlot to plot terms of the sequence
b(n)=sin(n).

b[n_] = Sin[n];
DiscretePlot[b[n], {n, 0, 500}, Filling -> None]

Well that's just hideous. Students just learning about sequences and
series aren't going to have any idea what's going on.

We can fix this behavior by setting Joined->False, like this:

DiscretePlot[s[k], {k, 1, 150}, Filling -> None, Joined -> False]

DiscretePlot[b[n], {n, 0, 500}, Filling -> None, Joined -> False]

The students are having trouble remembering to do this, though, and I
wonder why on earth Wolfram would design DiscretePlot this way. When I
go to make a DiscretePlot, I do not *ever* expect -- or want -- the
points to be joined. And why are the points not joined for < 150 points,
and joined for >= 150 points? This seems completely arbitrary, and in
fact I only discovered the 150 point cut-off by trial and error, and
could find no explanation in the Documention as to what
Joined->Automatic even does.

I'd be far happier if DiscretePlot had Joined->False by default.

--