Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.6K Views
|
2 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Why is this graph both continuous and discrete?

Posted 2 years ago
POSTED BY: Viorel Negoita
2 Replies

Compare:

Plot[Sum[i, {i, 1, n}], {n, 1, 50}]
Plot[Sum[i, {i, 1, Floor[n]}], {n, 1, 50}]
Plot[Evaluate@Sum[i, {i, 1, n}], {n, 1, 50}]

When you evaluate Plot[Sum[i, {i, 1, n}], {n, 1, 50}], floating points values of n are replaced into Sum[i, {i, 1, n}], giving something like, for example,

Sum[i, {i, 1, 20.4}]

The variable i then takes the values 1,2,3,... until 20 and then stops. This accounts for the steps in the plot. The parts in the plot without steps are probably where the refining algorithm does not feel the need to insert further points, because it did not detect a sharp curvature at its first attempt.

With Evaluate@Sum[i, {i, 1, n}] the sum is replaced by 1/2 n (1 + n), which gives a smooth curve.

POSTED BY: Gianluca Gorni
Posted 2 years ago

There are not enough PlotPoints. Try

Plot[Sum[i, {i, 1, n}], {n, 1, 50}, PlotPoints -> 100]

or

ListStepPlot[Table[Sum[i, {i, 1, n}], {n, 1, 50}]]
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard