newuser,topic05

(5) Graphics

Before examining this topic, please make sure that you have read: (1) Working Through the New User's Tour.

Warning: Most graphics commands require a significant amount of memory. Please make sure that your system has at least 8 MB of memory before executing this worksheet.

Maple supports both two-dimensional and three-dimensional graphics. You can graph explicit, implicit, and parametric functions, as well as data sets. By default, graphs and animations appear as inline graphics in your worksheet.

Use the restart command to clear Maple's internal memory and get started with this page of the tour.

> restart;

Related functions in Maple are grouped into packages and can be accessed by using the notation package [ function ]( command ) . The with command allows you to access the functions in a library package by their short names. If you enter the command followed by a semicolon (instead of a colon), a list of the functions available in the package is displayed.

> with(plots);

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...

> with(plottools);

[arc, arrow, circle, cone, cuboid, curve, cutin, cu...
[arc, arrow, circle, cone, cuboid, curve, cutin, cu...
[arc, arrow, circle, cone, cuboid, curve, cutin, cu...
[arc, arrow, circle, cone, cuboid, curve, cutin, cu...

Two-dimensional Graphs

Maple's two-dimensional plotting tools allow you to graph multiple functions, produce conformal maps, and generate log, loglog, parametric, phase, polar, and contour plots. You can graph inequalities, implicitly given functions, solutions to differential equations, and root loci. You also have full control over the fonts used for titles, labels, and other text in your plots.

Example of 2-D Plotting

The following example generates the plot of y = tan(x) .

> plot( tan(x), x=-2*Pi..2*Pi, y=-4..4, discont=true,
title="y = tan(x)" );

[Maple Plot]

Notice how Maple handles functions with discontinuities.

The implicitplot Command

The command implicitplot (from the plots package) graphs an implicit equation of two variables without resorting to an explicit solution of any variable.

The following command simultaneously graphs the unit circle x^2+y^2 = 1 and the exponential function y = exp(x) :

> implicitplot( { x^2+y^2=1, y=exp(x) }, x=-Pi..Pi, y=-Pi..Pi,
scaling=CONSTRAINED );

[Maple Plot]

The plottools Package

The plottools package contains many commands for generating and manipulating graphical objects, such as the unit circle centered at (0,0).

> c := circle( [0, 0], 1, color=green ):

> display( c, scaling=CONSTRAINED, title="Unit Circle" );

[Maple Plot]

Three-dimensional Graphs

Maple can plot surfaces and curves in three dimensions. This includes explicitly and parametrically given surfaces, as well as solutions to differential equations. You can modify the display of your graphics by changing aspects such as fonts, lighting, and coloring.

The following example plots a function of two variables, namely the function defined by z = x*exp(-x^2-y^2) .

> plot3d( x*exp(-x^2-y^2), x=-2..2, y=-2..2, axes=BOXED,
title="A Surface Plot" );

[Maple Plot]

To rotate the plot, click the plot to select it. Position the mouse pointer in the plot, but not directly on the curve or surface. Drag the mouse pointer to reorient the plot. Release the mouse button when the plot is oriented correctly.

Maple can construct nested polyhedra.

> p := display( seq( cutout(v, 4/5), v=stellate(dodecahedron(), 3) ),
style=PATCH ):

> q := display( cutout(icosahedron([0, 0, 0], 2.2), 7/8) ):

> display( p, q, scaling=CONSTRAINED, title="Nested Polyhedra" );

[Maple Plot]

Animation of Graphs

The plots package supports two- and three-dimensional animations. You can use this feature to illustrate real-world processes in which information changes over time.

> animate3d( cos(t*x)*sin(t*y), x=-Pi..Pi, y=-Pi..Pi, t=1..2 );

[Maple Plot]

To begin the animation: From the Animation menu, choose Play . To stop the animation at any time: From the Animation menu, choose Stop .

Linear Inequalities Graphs

Maple can plot linear inequalities.

The Maple command inequal plots the following system of linear inequalities: 0 < x+y , x-y <= 1 , and y = 2 .

> inequal( { x+y > 0, x-y <= 1, y = 2 }, x=-3..3, y=-3..3,
optionsfeasible=(color=red), optionsopen=(color=blue,
thickness=2), optionsclosed=(color=green, thickness=3),
optionsexcluded=(color=yellow) );

[Maple Plot]

Click here to return to the Main Menu.

© 2009 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.