Efficient Computation with Plotting Commands - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Graphics : Efficient Computation with Plotting Commands

Efficient Computation with Plotting Commands


This help page provides details about how numeric computation is performed by Maple's plotting commands.  Included are suggestions on how to get the most efficient performance from the commands.


The Floating-Point Environment

Options that Influence Efficiency

Plot Data Structures

Complex Values


The Floating-Point Environment


Most plotting commands attempt to evaluate the input expressions or procedures using the floating-point hardware of the underlying system whenever possible. This is done through calls to the evalhf command.  If the environment variable Digits is greater than the value of evalhfDigits, or if an initial attempt using evalhf fails, then the slower evalf command is used for numerical evaluation.


To maximize efficiency for these commands, expressions and procedures passed to plotting commands should be written so that they can be evaluated by evalhf if possible. For more information on the functions and constructs supported by evalhf, see the evalhf/procedure and evalhf/fcnlist help pages.


One exception is the command plot when the adaptive=geometric setting is active (which is the case by default for many situations; see the plot/adaptive help page for details). This uses a special evaluation environment based on RealBox objects. This evaluation environment only works with the expressions and commands listed on the RealBox help page.

Options that Influence Efficiency


When there is a trade off between computational efficiency and plot quality, the default settings for the plot command instruct Maple to favor plot quality. In some cases, this may not be what you want: for example, in some interactive applications where a plot needs to be regenerated in response to an event coming from embedded components, or if you create an animation. In particular, the adaptive=geometric setting often gives higher quality plots than adaptive=true, but it is slower to compute. For greater computational efficiency, you can use the adaptive=true option, or other values of the adaptive option, as discussed on the plot/adaptive help page. (When you create an animation using the plots[animate] command, this will usually already be selected for you by default, but when you create each frame individually and then use plots[display] with the insequence option, it is not.)


Another option that affects computational efficiency is the redraw option. It can be passed to the plot and plots[display] commands. The option is true by default. This option enables two different features:


When panning, zooming, or resizing a non-parametric plot in Cartesian coordinates that was generated with the redraw=true setting, the plot is in most cases regenerated to fill in missing plot data.


When combining a collection of 2-D static plots created using the plot command using the plots[display] command, the inputs are converted to a single plot command and then redrawn in some cases. This is useful, for example, if no domain was specified for some or all of these plot commands: if the automatically chosen plot domains differ between these plots, then without this feature, there would be parts of the resulting plot where data is missing.


In situations where you want to ensure greater computational efficiency, using the redraw=false option turns these features off, which eliminates the associated overhead. The option is also discussed in the plots[display] help page and the redraw section of the plot/options help page.

Plot Data Structures


The data structure used for storing plots is described on the plot/structure help page.  Most plot structures allow the data to be stored in either a list or an rtable.  It is recommended that you build plot structures through the commands in the plotting library, which include the plot and plot3d commands and the plots and plottools packages.  However, if you wish to build the plot structures directly, then rtables should be used for those structures that support them, and they should be created with the datatype=float and order=C_order options.

Complex Values


Most of Maple's plotting commands are meant to work with real-valued functions, though there exist specialized commands such as plots:-complexplot for plotting complex-valued functions.  Generally, when evaluation of the input expression or procedure results in a complex value, the value is replaced by an undefined value.  Many plotting commands check for numbers with very small imaginary parts and will convert these numbers to real numbers, with the criteria for dropping an imaginary part depending on the Digits environment variable and on its relative size compared to the real part. This procedure helps to avoid problems caused by round-off errors during the computation.



If the function to be plotted has a discontinuity, then evaluation at the point of discontinuity may lead to an undefined value, which results in a gap in the plotted curve or surface.  More often, the function is evaluated at points very close to the discontinuity, and this leads to a distorted view of the plot when the values are extremely large or small and an inappropriate connecting of the points over the discontinuity.


In the 2-D case, the plot command with default options detects most discontinuities. In cases for which the plot command fails to detect a discontinuity automatically, or when using the adaptive=true or adaptive=false option, you can use the discont = true option to force plot to do extra work to detect discontinuities by using the discont command.


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.

See Also