Message Boards Message Boards

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

Why is this graph both continuous and discrete?

Posted 7 months ago

I just installed Mathematica on a Raspberry Pi and I am playing around and I run into this. If I do the graph up to 34, I see discrete steps. Over 35, I start to see a mix of discrete steps and continuous line. This case below, with the graph going from 1 to 50 is a good example. Why is the line changing from steps to continuous, back to steps and back to continuous? changes the 50 to 34 and it looks only steps.

Graph

POSTED BY: Viorel Negoita
2 Replies
Posted 7 months 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

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
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract