Plotting discontinous expressions

Finding discontinuities

Now that we have discussed the piecewise function, the next step is to find discontinuities in an expression. For example,

[> discont( piecewise( x < -1, 0, x <= 0, 1, x <= 1, x^2, 1 ), x );

${-1, 0}$

You will note that while the definitions of the function differ on either side of the point $x = 1$, the limits as each expression approaches $x = 1$ is equal, so there is no discontinuity at $x = 1$.

In some cases, there are countably many discontinuities, such as the tangent function:

[> discont( tan( x ), x );

$\left\{ \pi \_Z1~ + \frac{1}{2} \pi \right\}$

You will note the tilde (~) following the symbol _Z1. This says that there is an assumption made about _Z1. You can find out about this assumption by asking Maple about this symbol:

[> about( _Z1 );
Originally _Z1, renamed _Z1~:
  is assumed to be: integer

Thus, this is a concise way of describing all integers times $\pi$ offset by $\frac{\pi}{2}$. We have, to this point, simply made assumptions on expressions we were trying to solve; however, this is a different mechanism open to Maple. We can do the following to find examples of such solutions:

[> seq( Pi*_Z1 + Pi/2, _Z1 = -5..5 );

$-\frac{9\pi}{2}, -\frac{7\pi}{2}, -\frac{5\pi}{2}, -\frac{3\pi}{2}, -\frac{\pi}{2}, \frac{\pi}{2}, \frac{3\pi}{2}, \frac{5\pi}{2}, \frac{7\pi}{2}, \frac{9\pi}{2}, \frac{11\pi}{2}$

Plotting expressions with discontinuities

Now that we have discussed the piecewise(...) function, one point we may have to consider is plotting such an expression. This is, of course, also an issue when plotting, for example, the tangent function.

By default, Maple creates a plot by using an intelligent sampling algorithm, but then ultimately connecting the dots. This leads to discontinuities appearing as being connected by straight vertical lines.

The 'discont' = true option has Maple attempt to find all discontinuities of the function that is being plotted, and to then instead perform a sequence of plots, so that the discontinuities appear as actual discontinuities in the plot.

This option requires significantly more computation than does regular plotting, as Maple will be called to detect the discontinuities and