Plotting Discontinuous Functions - Maple Programming Help

Home : Support : Online Help : Graphics : 2-D : Options : plot/discont

Plotting Discontinuous Functions

The discont Option

 If a function with a discontinuity is being plotted, problems can occur. First, evaluation at or very near the point of discontinuity may lead to undefined values or extremely large or small values, thus creating a distorted view of the plot. Also, there may be an inappropriate connecting of neighboring points over the discontinuity.
 In the 2-D case, the discont option can be used with the plot command when you suspect a discontinuity.  The plot command uses the discont and fdiscont commands to detect discontinuities and divides the plotting range into subranges over which the plot is continuous.
 The discont option takes values true and false, with false being the default. It can also accept a list of suboptions as the value. When discont is true or a list, then the procedure described above for detecting discontinuities is followed. One suboption is the showremovable option, described in the section below. Other suboptions are symbol and symbolsize to control the look of the points that are drawn to mark the points of discontinuity. Note that points are not drawn when fdiscont is used, as described below.
 The discont option is not available in the 3-D case.  In this situation, it is recommended that you divide the plotting ranges into subranges to avoid the discontinuities, generate the individual plots and then combine them using the plots[display] command.  The view option can be used to control the ranges in the final display.

Suboptions

 A number of suboptions are available for the discont option.
 • showremovable=t
 Show removable discontinuities; t can be true, false or a list. Details are given in the Removable Discontinuities section below.
 • symbol=t
 Change the symbol used to mark points of discontinuity. The symbol values t are described on the plot/options help page.
 • symbolsize=t
 Change the symbolsize used to mark points of discontinuity; t is a positive integer.
 • usefdiscont=t
 Immediately use the fdiscont command to find discontinuities without using discont first; t can be true, false or a list. Details are given in the section below.

The discont and fdiscont Commands

 The discont and fdiscont commands are used by the plot command to detect the discontinuities. Normally, the discont command is applied if possible.  If this command fails or is not applicable (e.g. when the input is an operator or procedure), then the fdiscont command is used.
 The usefdiscont=t can be used to control how fdiscont is used. If t is true or a list, then no attempt with the discont command is made. Instead, fdiscont will be used immediately, and if t is a list, then the contents of t are passed as options to the fdiscont command. See the fdiscont help page for a description of options that the command accepts.
 Note that points, indicating either function values or removable discontinuities, are never drawn when the fdiscont command is used, as this command does not return the points of discontinuity. Rather, it returns ranges in which there appear to be discontinuities.

Removable Discontinuities

 Usually, removable discontinuities are ignored. However, if the showremovable suboption is provided, then a circle is drawn on the plot to mark the point of discontinuity.
 The showremovable suboption takes the values true or false. Suboptions to showremovable may also be provided in a list. These suboptions, which include color, symbol and symbolsize, affect the symbol used to mark the discontinuity.
 The showremovable suboption has no effect when an operator or procedure is being plotted. In this case, the plotting command must rely on the fdiscont command, which does not return exact points of discontinuity, as described above.
 With this option, singular points of the expression that are not necessarily removable discontinuities may be plotted. Examples of these cases include the Dirac function with zero argument, or signum(1,x) for x=0.

Examples

 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > $\mathrm{plot}\left(\mathrm{tan}\left(x\right),x=-2\mathrm{Pi}..2\mathrm{Pi},y=-4..4,\mathrm{discont}=\mathrm{true}\right)$
 > $\mathrm{plot}\left(\frac{{x}^{2}-1}{x-1},x=-2..2,\mathrm{discont}=\mathrm{true}\right)$

Show the location of the removable discontinuity. (This is also the command used to create the plot from the Plotting Guide.)

 > $\mathrm{plot}\left(\frac{{x}^{2}-1}{x-1},x=-2..2,\mathrm{discont}=\left[\mathrm{showremovable}\right]\right)$

Change the color and size of symbol used to mark the discontinuity.

 > $\mathrm{plot}\left(\frac{{x}^{2}-1}{x-1},x=-2..2,\mathrm{discont}=\left[\mathrm{showremovable}=\left[\mathrm{color}="Brown",\mathrm{symbolsize}=15\right]\right]\right)$

Plot a piecewise function with a removable discontinuity.

 > $\mathrm{plot}\left(\mathrm{piecewise}\left(x=-2,6,x-1\right),\mathrm{discont}=\left[\mathrm{showremovable}\right],\mathrm{color}="Magenta"\right)$

Pass options to the fdiscont command.

 > $\mathrm{plot}\left(\mathrm{ceil}\left(\mathrm{sin}\left(\mathrm{Pi}x\right)\right),x=-1..10,\mathrm{discont}=\left[\mathrm{usefdiscont}=\left[\mathrm{bins}=35\right]\right],\mathrm{view}=\left[-1..10,0..2\right],\mathrm{thickness}=2\right)$