Graphing in Maple Maple can be a very powerful tool for creating graphs. This is an overview of some of the more common 2-D and 3-D graphs that you might encounter in a calculus class. More thorough descriptions of plotting tools,options and examples are available in Maple Help if you need something specific. Executable commands are placed after Maple prompts (">") and can be executed by pressing "Enter" after each prompt. Note that many commands will rely on information from previous commands, order of execution is important! Hint: use Shift+Enter to enter a new line without creating a new prompt. Useful for making code more readable in loops, or when defining several variables at once. First, we will use restart to clear all variables; do this at the beginning of every worksheet to avoid unexpected results! with() is used to load additional Maple packages; there are several packages for graphing available. The plots package includes tools for 2-D and 3-D graphing. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2JVEocmVzdGFydEYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21vR0YkNi1RIjtGJy9GM1Enbm9ybWFsRicvJSZmZW5jZUdRJmZhbHNlRicvJSpzZXBhcmF0b3JHRjEvJSlzdHJldGNoeUdGPS8lKnN5bW1ldHJpY0dGPS8lKGxhcmdlb3BHRj0vJS5tb3ZhYmxlbGltaXRzR0Y9LyUnYWNjZW50R0Y9LyUnbHNwYWNlR1EmMC4wZW1GJy8lJ3JzcGFjZUdRLDAuMjc3Nzc3OGVtRictSSdtc3BhY2VHRiQ2Ji8lJ2hlaWdodEdRJjAuMGV4RicvJSZ3aWR0aEdGTC8lJmRlcHRoR0ZVLyUqbGluZWJyZWFrR1ElYXV0b0YnLUYsNiNRIUYn QyQtSSV3aXRoRzYiNiNJJnBsb3RzRzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliR0YlIiIi
<Text-field style="Heading 1" layout="Heading 1">2-D Graphing</Text-field> Let's start by plotting the following function QyQ+SSJmRzYiZio2I0kieEdGJUYlNiRJKW9wZXJhdG9yR0YlSSZhcnJvd0dGJUYlKiYtSSRzaW5HRiU2IyokOSQhIiIiIiJGMUYyRiVGJUYlRjI= The plot() command will handle 2 dimensional plotting. With no other options specified, Maple may automatically select a poor viewing window. QyQtSSVwbG90RzYiNiMtSSJmR0YlNiNJInhHRiUiIiI= This doesn't show our function well, so let's include domain and range. I'd like to see how this function behaves around x=0. QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiUtSSJmR0YoNiNJInhHRigvRi07JCEiIkYxJCIiIkYxL0kieUdGKDshJCsjIiQrI0Yz I'd like to compare it to another function, so let's graph them on the same set of coordinates. You can graph more than one thing at a time by using brackets and separating them by commas. QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiU3JC1JImZHRig2I0kieEdGKCokRi4hIiIvRi47JEYwRjAkIiIiRjAvSSJ5R0YoOyEkKyMiJCsjRjU= We can change the color for each graph using the "color" option to get better definition between the graphs: QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiY3JC1JImZHRig2I0kieEdGKCokRi4hIiIvRi47JEYwRjAkIiIiRjAvSSJ5R0YoOyEkKyMiJCsjL0kmY29sb3JHRig3JEkmZ3JlZW5HRihJJWJsdWVHRihGNQ== We can also plot points, these will be represented as lists of x and y values in vector form, plot style is specified as "point": QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiQtSSQ8fGdyPkdGKDYkLUkkPCw+R0YoNicjIiIiIiM1I0YxIiM/I0YxIiNJI0YxIiNTI0YxIiNdLUYuNidGMkY0RjZGOEY6L0kmc3R5bGVHRihRJnBvaW50RihGMQ== These can be displayed with different symbols, colors and sizes as well. QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNictSSQ8fGdyPkdGJzYkLUkkPCw+R0YnNicjIiIiIiM1I0YxIiM/I0YxIiNJI0YxIiNTI0YxIiNdLUYuNidGMkY0RjZGOEY6L0kmc3R5bGVHRihRJnBvaW50RigvSSdzeW1ib2xHRiZRKWFzdGVyaXNrRigvSSZjb2xvckdGKFEmYmxhY2tGKC9JK3N5bWJvbHNpemVHRihGNEYx Parametric Equations Parametric equations can be plotted as well, these are expressed as a vector, again using the bracket notation: QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiM3JS1JJHNpbkdGJTYjSSJ0R0YoLCQtSSRjb3NHRiVGLSIiJC9GLjsiIiEsJEkjUGlHRiYiIiMiIiI= Non-Cartesian Coordinates We aren't restricted to using cartesian coordinates; the coords option allows us to change coordinate systems. For instance, let's plot something given in polar coordinates. Notice that the function is defined parametrically. QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiQ3JSomLUkkc2luR0YlNiMsJEkidEdGKCIiJiIiIi1JJGNvc0dGJTYjLCRGMCIiJEYyRjAvRjA7IiIhLCRJI1BpR0YmIiIjL0knY29vcmRzR0YoSSZwb2xhckdGKEYy We can also use the axiscoordinates option to display polar axes instead: QyQtSSVwbG90RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiU3JSomLUkkc2luR0YlNiMsJEkidEdGKCIiJiIiIi1JJGNvc0dGJTYjLCRGMCIiJEYyRjAvRjA7IiIhLCRJI1BpR0YmIiIjL0knY29vcmRzR0YoSSZwb2xhckdGJy9JMGF4aXNjb29yZGluYXRlc0dGKEZARjI= Implicit Plotting It is also possible to plot implicitly defined graphs, but plot() does not handle these. Use implicitplot() instead; the options are very similar to those used for plot(). QyQtSS1pbXBsaWNpdHBsb3RHNiI2JS8sJiokSSJ4R0YlIiIjIiIkKiRJInlHRiVGKyEiJSIiIi9GKjshIzUiIzUvRi5GMkYw However, see how jagged the graph is near x=0? We can smooth this out by using the gridrefine option. QyQtSS1pbXBsaWNpdHBsb3RHNiI2Ji8sJiokSSJ4R0YlIiIjIiIkKiRJInlHRiVGKyEiJSIiIi9GKjshIzUiIzUvRi5GMi9JK2dyaWRyZWZpbmVHRiVGK0Yw JSFH
<Text-field style="Heading 1" layout="Heading 1">Multiple Graphs Together</Text-field> Since we can only plot one style of graph at a time, in order to combine plot styles, we will need to define these as separate graphs. You can save these graphs to variable names. QyY+SSJGRzYiLUklcGxvdEc2JCUqcHJvdGVjdGVkR0koX3N5c2xpYkdGJTYmNyQtSSJmR0YlNiNJInhHRiUqJEYwISIiL0YwOyRGMkYyJCIiIkYyL0kieUdGJTshJCsjIiQrIy9JJmNvbG9yR0YlNyRJJmdyZWVuR0YlSSVibHVlR0YlRjI+SSJQR0YlLUYnNictSSQ8fGdyPkdGKjYkLUkkPCw+R0YqNicjRjciIzUjRjciIz8jRjciI0kjRjciI1MjRjciI10tRko2J0ZNRk9GUUZTRlUvSSZzdHlsZUdGJVEmcG9pbnRGJS9JJ3N5bWJvbEdGKVEpYXN0ZXJpc2tGJS9GPlEmYmxhY2tGJS9JK3N5bWJvbHNpemVHRiVGT0Yy Now, we can use the display() command to plot these two graphs together. QyQtSShkaXNwbGF5RzYiNiRJIkZHRiVJIlBHRiUiIiI=
<Text-field style="Heading 1" layout="Heading 1">3-D Graphing</Text-field> Three dimensional graphs can be plotted with the plot3d() command. Many of the options are the same, however, remember that you must specify domain! The default color varies, we can vary the color with x or y or choose a solid color. We can also vary the opacity with transparency. QyQtSSdwbG90M2RHNiI2JSomSSJ4R0YlIiIiLUkkZXhwR0YlNiMsJiokRigiIiMhIiIqJEkieUdGJUYvRjBGKS9GKDtGMEYpL0YyOyEiI0YvRik= QyQtSSdwbG90M2RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2JiomSSJ4R0YoIiIiLUkkZXhwR0YlNiMsJiokRisiIiMhIiIqJEkieUdGKEYyRjNGLC9GKztGM0YsL0Y1OyEiI0YyL0kmY29sb3JHRigqJkYrRixGNUYsRiw= QyQtSSdwbG90M2RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2JyomSSJ4R0YoIiIiLUkkZXhwR0YlNiMsJiokRisiIiMhIiIqJEkieUdGKEYyRjNGLC9GKztGM0YsL0Y1OyEiI0YyL0kmY29sb3JHRihGKy9JLXRyYW5zcGFyZW5jeUdGKCQiIiZGM0Ys We can also define equations parametrically, which can look like graphing three equations at once if we are not careful! Include the plotlist option to specify a list of equations rather than a parametric equation. QyQtSSdwbG90M2RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2JTclKihJInhHRigiIiItSSRzaW5HRiU2I0YsRi0tSSRjb3NHRiU2I0kieUdGKEYtKihGLEYtLUYyRjBGLUYxRi0qJkYsRi0tRi9GM0YtL0YsOyIiISwkSSNQaUdGJiIiIy9GNDtGO0Y9Ri0= QyQtSSdwbG90M2RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2KDclKihJInhHRigiIiItSSRzaW5HRiU2I0YsRi0tSSRjb3NHRiU2I0kieUdGKEYtKihGLEYtLUYyRjBGLUYxRi0qJkYsRi0tRi9GM0YtL0YsOyIiISwkSSNQaUdGJiIiIy9GNDtGO0Y9SSlwbG90bGlzdEdGKC9JJmNvbG9yR0YoNyVJJ3llbGxvd0dGKEkkcmVkR0YoSSZncmVlbkdGKC9JLXRyYW5zcGFyZW5jeUdGKCQiIiUhIiJGLQ== Other Coordinate Systems We can also use different coordinate systems, just as we did with plot(). QyQtSSdwbG90M2RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2KComKSQiIzghIiJJInhHRigiIiItSSRzaW5HRiU2I0kieUdGKEYwL0YvO0YuLCRJI1BpR0YmIiIjL0Y0OyIiIUY4L0knY29vcmRzR0YoSSpzcGhlcmljYWxHRigvSSZjb2xvckdGKEY0L0ktdHJhbnNwYXJlbmN5R0YoJCIiJEYuRjA= QyQtSSdwbG90M2RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2KDclLCYiIiUiIiIqJkkieEdGKEYtLUkkY29zR0YlNiMsJEkieUdGKCNGLSIiI0YtRi1GNComRi9GLS1JJHNpbkdGJUYyRi0vRi87LCRJI1BpR0YmISIiRj0vRjQ7IiIhLCRGPUY2L0knY29vcmRzR0YoSSxjeWxpbmRyaWNhbEdGKC9JLXRyYW5zcGFyZW5jeUdGKCQiIiRGPi9JJmNvbG9yR0YoRjRGLQ== Implicit Plotting As with plot(), we cannot plot implicitly using plot3d() however, we can use implicitplot3d(). Change the grid option to create a more refined plot. QyQtSS9pbXBsaWNpdHBsb3QzZEc2IjYmLywoKiRJInhHRiUiIiMiIiIqJEkieUdGJUYrRiwqJEkiekdGJUYrI0YsIiIkRiwvRio7ISIjRisvRi5GNC9GMEY0Riw= QyQtSS9pbXBsaWNpdHBsb3QzZEc2IjYpLywoKiRJInhHRiUiIiMiIiIqJEkieUdGJUYrRiwqJEkiekdGJUYrI0YsIiIkRiwvRio7ISIjRisvRi5GNC9GMEY0L0klZ3JpZEdGJTclIiM/RjtGOy9JJmNvbG9yR0YlSSVwaW5rR0YlL0ktdHJhbnNwYXJlbmN5R0YlJEYyISIiRiw=
<Text-field style="Heading 1" layout="Heading 1">Animations</Text-field> How would you go about plotting things with more than three dimensions? Complex plots use color to represent the fourth dimension; we can also use time as a third or fourth dimension and create an animation! The animate() command will create a two or three dimensional animation using other plotting commands, while animate3d() will create a three dimensional animation. We will use t as our time variable, click on the graph and use the controls at the top of the page to see the animation. QyQtSShhbmltYXRlRzYiNiVJJXBsb3RHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHRiU3JC1JJHNpbkdGKDYjKiZJInRHRiUiIiJJInhHRiVGMS9GMjssJEkjUGlHRikhIiJGNi9GMDtGMSIiJUYx QyQtSShhbmltYXRlRzYiNiVJLWltcGxpY2l0cGxvdEdGJTclLywmKiRJInhHRiUiIiMiIiIqJEkieUdGJUYtRi5JInRHRiUvRiw7ISInIiInL0YwRjMvRjE7IiIhIiImRi4= QyQtSShhbmltYXRlRzYiNiVJJ3Bsb3QzZEc2JCUqcHJvdGVjdGVkR0koX3N5c2xpYkdGJTclLCYqJkkidEdGJSIiIkkieEdGJSIiI0YvKiRJInlHRiVGMUYxL0YwOyEjNSIjNS9GM0Y1L0YuOyIiIUYxRi8= QyQtSSphbmltYXRlM2RHNiI2JyomLUkkY29zRzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliR0YlNiMqJkkidEdGJSIiIkkieEdGJUYwRjAtSSRzaW5HRio2IyomRi9GMEkieUdGJUYwRjAvRjE7LCRJI1BpR0YrISIiRjovRjZGOC9GLztGMCIiIy9JJmNvbG9yR0YlRjFGMA==
51¸£ÀûÉç Mathematics Department, Allison Chapin 2011 JSFH