# Mathematica plots a discontinuity in piecewise function that does not exist [duplicate]

I have the following function defined:

IntImpTri[r1_, r2_, r_] :=
Piecewise[{
{((4/((r2 - r1)^2)) ((r^2 - r1^2)/2 - r1 (r - r1))),
r >= r1 && r < ((r1 + r2)/2)},
{(1/2 - (2/((r2 - r1)^2)) (r^2 - ((r1 + r2)/2)^2) +
(4/((r2 - r1)^2)) r2 (r - ((r1 + r2)/2))),
r >= ((r1 + r2)/2) && r < r2},
{1, r >= r2}}, 0];


I am using Mathematica 9 and I do not understand why, when I try to plot this function, which is the integral function of a triangle pulse, the figure shows an interruption in the line.

If I try the following command: Plot[IntImpTri[0, 4, r], {r, -1, 5}], I get the following output: There is a discontinuity around x=2 but the piecewise covers everything!

• I am using Mathematica under Unix... – Andry Apr 30 '13 at 21:40
• I am not sure exactly why it is missing this point (must be something with how Plot is decided to recurse), but try increasing the PlotPoints to specify how many initial sample points to use: Plot[IntImpTri[0, 4, r], {r, -1, 5}, PlotPoints -> 300] – chuy Apr 30 '13 at 21:45
• possible duplicate of Plot showing discontinuity where it shouldn't. Also a duplicate of mathematica.stackexchange.com/questions/19877/…. For more information, do a search. – whuber Apr 30 '13 at 22:14

Plot[IntImpTri[0, 4, r], {r, -1, 5}, Exclusions -> None] 