To avoid listing all the commands in the plots

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 117 16 14 12 10 8 6 4 2 –2 –1 0 1 2 3 4 By default, Maple does not join the points with straight lines. Use the style=line option to plot the lines. You can also use the menus to draw lines. > pointplot( data_list, style=line ); 16 14 12 10 8 6 4 2 –2 –1 0 1 2 3 4 To change the appearance of the points, use the context-sensitive menu or the symbol and symbolsize options. > data_list_2:=[[1,1], [2,2], [3,3], [4,4]]; data _list _2 := [[1, 1], [2, 2], [3, 3], [4, 4]] > pointplot(data_list_2, style=point, symbol=cross, > symbolsize=30); 118 • Chapter 5: Plotting 4 3.5 3 2.5 2 1.5 1 1 1.5 2 2.5 3 3.5 4 Use the CurveFitting package to fit a curve through several points, and then use the plot function to see the result. For more information, refer to the ?CurveFitting help page. Refining Plots Maple uses an adaptive plotting algorithm. It calculates the value of the function or expression at a modest number of approximately equidistant points in the specified plotting interval. Maple then computes more points within the subintervals that have a large amount of fluctuation. Occasionally, this adaptive algorithm does not produce a satisfactory plot. > plot(sum((-1)^(i)*abs(x-i/10), i=0..50), x=-1..6); 3.4 3.2 3 2.8 2.6 –1 0 1 2 3 x 4 5 6 To refine this plot, indicate that Maple compute more points. > plot(sum((-1)^(i)*abs(x-i/10), i=0..50), x=-1..6, > numpoints=500); 5.2 Graphing in Three Dimensions • 119 3.4 3.2 3 2.8 2.6 –1 0 1 2 3 x 4 5 6 For further details and examples, refer to the ?plot and ?plot,options help pages. 5.2 Graphing in Three Dimensions You can plot a function of two variables as a surface in three-dimensional space. This allows you to visualize the function. The syntax for plot3d is similar to that for plot. Plot an explicit function, z = f (x, y ). > plot3d( sin(x*y), x=-2..2, y=-2..2 ); You can rotate the plot by dragging in the plot window. The menus allow you to change various characteristics of a plot. As with the plot command, plot3d can graph user-defined functions. > f := (x,y) -> sin(x) * cos(y); 120 • Chapter 5: Plotting f := (x, y ) → sin(x) cos(y ) > plot3d( f(x,y), x=0..2*Pi, y=0..2*Pi ); By default, Maple displays the graph as a shaded surface. To change the surface, use the context-sensitive menu or the style option. For example, style=hidden draws the graph as a hidden wireframe structure. > plot3d( f(x,y), x=0..2*Pi, y=0..2*Pi, style=hidden ); For a list of style options, refer to the ?plot3d,options help page. The range of the second parameter can depend on the first parameter. > plot3d( sqrt(x-y), x=0..9, y=-x..x ); 5.2 Graphing in Three Dimensions • 121 Parametric Plots You cannot specify some surfaces explicitly as z = f (x, y ). The sphere is an example of such a plot. As for two-dimensional graphs (see section 5.1), one solution is a parametric plot. Make the three coordinates, x, y , and z , functions of two parameters, for example, s and t. You can specify p...
View Full Document

Ask a homework question - tutors are online