Search code examples
wolfram-mathematica

Why is the plot changing when I change the range?


cdf[s_] := Piecewise[{{1 - (10/s), s > 10}}] Plot[cdf[s], {s, 0, 20}] And it plots correctly. correct graph

When I modify the range to, say
Plot[cdf[s], {s, 0, 200}] It plots incorrectly. incorrect graph

Is this expected behavior? Am I misunderstanding something?

I played around with different ranges. The graph presents correctly up to around 180, then it starts displaying incorrectly.


Solution

  • The plot changes because the PlotRange changes. Try to add, e.g., PlotRange -> All

    See the documentation at https://reference.wolfram.com/language/ref/PlotRange.html