Differential Equations with Linear Algebra Reintroduction to Maple The purpose of this notebook is to meet Maple for the first time and try to get a little acquainted with its graphing capabilities. This notebook has a number of sections. The last section contains a quiz. The main purpose is to learn the most useful graphing commands and their syntax. Thus, you should be able to work the quiz by studying the examples in the preceeding sections. This is an open-communication quiz, meaning that you may ask anyone (including your instructor, but especially your partner) for help at any time.
<Text-field style="Heading 1" layout="Heading 1">Doing some simple computations.</Text-field> Here is how one does addition. Enter "3+4;" and hit the enter key. LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbW5HRiQ2KVEiM0YnLyUnZmFtaWx5R1ErTW9ub3NwYWNlZEYnLyUlYm9sZEdRJXRydWVGJy8lK2ZvcmVncm91bmRHUSpbMjU1LDAsMF1GJy8lMGZvbnRfc3R5bGVfbmFtZUdRLE1hcGxlfklucHV0RicvJSxtYXRodmFyaWFudEdRJWJvbGRGJy8lK2ZvbnR3ZWlnaHRHRj0tSSNtb0dGJDYvUScmcGx1cztGJ0Y1RjgvRjxRJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0ZILyUpc3RyZXRjaHlHRkgvJSpzeW1tZXRyaWNHRkgvJShsYXJnZW9wR0ZILyUubW92YWJsZWxpbWl0c0dGSC8lJ2FjY2VudEdGSC8lJ2xzcGFjZUdRLDAuMjIyMjIyMmVtRicvJSdyc3BhY2VHRlctRiw2KVEiNEYnRi9GMkY1RjhGO0Y+LUZBNi9RIjtGJ0Y1RjhGREZGL0ZKRjRGS0ZNRk9GUUZTL0ZWUSYwLjBlbUYnL0ZZUSwwLjI3Nzc3NzhlbUYnLyUrZXhlY3V0YWJsZUdGSEZE If you want to suppress output, use a colon instead of a semicolon. To store a quantity in a named location use ":=". Here 10! is stored in LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUkjbWlHRiQ2JVEiYUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy9GM1Enbm9ybWFsRic=. a := 10!; It is best to write out multiplication explicitly. a := 3; b := 4; 5*a; a*b; Note that the semicolon is required in multiline computations. Most of the standard functions are accessed in the same manner as on a calculator. Here are sin and cos of 1.1. (In this case a <shift><enter> was used to put the expressions on different lines.) LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYrLUkjbWlHRiQ2KlEkc2luRicvJSdmYW1pbHlHUStNb25vc3BhY2VkRicvJSVib2xkR1EldHJ1ZUYnLyUnaXRhbGljR1EmZmFsc2VGJy8lK2ZvcmVncm91bmRHUSpbMjU1LDAsMF1GJy8lMGZvbnRfc3R5bGVfbmFtZUdRLE1hcGxlfklucHV0RicvJSxtYXRodmFyaWFudEdRJWJvbGRGJy8lK2ZvbnR3ZWlnaHRHRkAtSShtZmVuY2VkR0YkNictRiM2JS1JI21uR0YkNilRJDEuMUYnRi9GMkY4RjtGPkZBLyUrZXhlY3V0YWJsZUdGNy9GP1Enbm9ybWFsRidGL0Y4RjtGTi1JI21vR0YkNjJRIjtGJ0YvRjJGOEY7Rj5GQS8lJmZlbmNlR0Y3LyUqc2VwYXJhdG9yR0Y0LyUpc3RyZXRjaHlHRjcvJSpzeW1tZXRyaWNHRjcvJShsYXJnZW9wR0Y3LyUubW92YWJsZWxpbWl0c0dGNy8lJ2FjY2VudEdGNy8lJ2xzcGFjZUdRJjAuMGVtRicvJSdyc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLUknbXNwYWNlR0YkNiYvJSdoZWlnaHRHUSYwLjBleEYnLyUmd2lkdGhHRl5vLyUmZGVwdGhHRmdvLyUqbGluZWJyZWFrR1EobmV3bGluZUYnLUYsNipRJGNvc0YnRi9GMkY1RjhGO0Y+RkFGQy1GUTYwRlNGL0Y4RjtGTkZURlZGWEZaRmZuRmhuRmpuRlxvRl9vRkxGTg== The exponential function is exp(x) and the constant pi is in Pi. Warning! You cannot use "e^x" for the exponential function or "pi" for the value of pi. sin(pi); sin(Pi); e^2.; exp(2.); One can use the evalf command to evaluation an expression numerically. Here are a couple examples. a := cos(2); evalf(a); evalf(a,5); b := exp(2); evalf(b);
<Text-field style="Heading 1" layout="Heading 1">Basic graphics</Text-field> Graphing in Maple is fairly simple. One can use a graphing command such as plot or plot3d. Here is the plot of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYqLUkjbWlHRiQ2JlEiZkYnLyUlc2l6ZUdRIzE4RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkobWZlbmNlZEdGJDYlLUYjNiUtRiw2JlEieEYnRi9GMkY1Ri8vRjZRJ25vcm1hbEYnRi9GQC1JI21vR0YkNi5RIj1GJ0YvRkAvJSZmZW5jZUdRJmZhbHNlRicvJSpzZXBhcmF0b3JHRkgvJSlzdHJldGNoeUdGSC8lKnN5bW1ldHJpY0dGSC8lKGxhcmdlb3BHRkgvJS5tb3ZhYmxlbGltaXRzR0ZILyUnYWNjZW50R0ZILyUnbHNwYWNlR1EsMC4yNzc3Nzc4ZW1GJy8lJ3JzcGFjZUdGVy1GQzYuUSJ+RidGL0ZARkZGSUZLRk1GT0ZRRlMvRlZRJjAuMGVtRicvRllGaG4tRiw2JlEkY29zRidGLy9GM0ZIRkAtRjk2JS1GIzYoLUkjbW5HRiQ2JVEiM0YnRi9GQEY9LUZDNi5RKiZ1bWludXMwO0YnRi9GQEZGRklGS0ZNRk9GUUZTL0ZWUSwwLjIyMjIyMjJlbUYnL0ZZRmpvLUZjbzYlUSIyRidGL0ZARi9GQEYvRkBGL0ZA. Note that there is no implicit multiplication and you must specify the range. plot(cos(3*x-2),x=-10..10); Here is a plot of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYrLUkjbWlHRiQ2JlEiZkYnLyUlc2l6ZUdRIzE4RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkobWZlbmNlZEdGJDYlLUYjNictRiw2JlEieEYnRi9GMkY1LUkjbW9HRiQ2LlEiLEYnRi8vRjZRJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0Y0LyUpc3RyZXRjaHlHRkgvJSpzeW1tZXRyaWNHRkgvJShsYXJnZW9wR0ZILyUubW92YWJsZWxpbWl0c0dGSC8lJ2FjY2VudEdGSC8lJ2xzcGFjZUdRJjAuMGVtRicvJSdyc3BhY2VHUSwwLjMzMzMzMzNlbUYnLUYsNiZRInlGJ0YvRjJGNUYvRkRGL0ZELUZBNi5RIn5GJ0YvRkRGRi9GSkZIRktGTUZPRlFGU0ZVL0ZZRlctRkE2LlEiPUYnRi9GREZGRltvRktGTUZPRlFGUy9GVlEsMC4yNzc3Nzc4ZW1GJy9GWUZhb0Zobi1GLDYmUSRzaW5GJ0YvL0YzRkhGRC1GOTYlLUYjNictSSVtc3VwR0YkNiVGPS1GIzYlLUkjbW5HRiQ2JVEiMkYnRi9GREYvRkQvJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYnLUZBNi5RIitGJ0YvRkRGRkZbb0ZLRk1GT0ZRRlMvRlZRLDAuMjIyMjIyMmVtRicvRllGW3EtRlxwNiVGZW5GXnBGZHBGL0ZERi9GREYvRkQ=. Note the use of the options axes and scaling. You can use the mouse to rotate the graph. plot3d(sin(x^2+y^2),x=-3..3,y=-3..3,axes=boxed, scaling=constrained); One can also use context menus to plot the results of your work. For example, here is the derivative of a function. Right click on the answer in blue and choose Plots - 2D Plot. Try changing the x-axis and the y-axis by right clicking the plot and choosing Axes - Range. diff(x^5*exp(-x^2/2)+cos(x^2/10-x/3),x);
<Text-field style="Heading 1" layout="Heading 1">Plots of single-valued functions</Text-field> Here are some standard plots of single-variable functions. Notice how the function and domain are specified. plot(sin(x),x=-Pi..3*Pi); There are many different options for plotting. In this case, "constrained" means that both the x- and y-axes have the same scaling factor. plot(sin(x),x=-Pi..3*Pi,scaling=constrained); One may plot functions simultaneously. Here, three colors are used to distinguish between the three graphs. plot([sin(x),x-x^3/6,x-x^3/6+x^5/120],x=-Pi..Pi,color=[red,blue,green]);
<Text-field style="Heading 1" layout="Heading 1">Single-valued functions of two variables (surfaces)</Text-field>
<Text-field style="Heading 1" layout="Heading 1">Basic calculus</Text-field> It is easy to find the derivative of a function. All derivatives of expressions in Maple are partial derivatives This means that you must specify the variable that is changing. Here is an example of the derivative of a function of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JlEieEYnLyUlc2l6ZUdRIzE4RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnRi8vRjZRJ25vcm1hbEYn. diff(cos(a*x+r^2),x); If was the variable the derivative would be diff(cos(a*x+r^2),r); One can exaluate the derivative, or any expression, using the eval or the subs commands. eval(-2*sin(a*x+b^2)*b,x=2); subs(x=2,-2*sin(a*x+b^2)*b); Inetgrals are as easy using the int command. Note that Maple does not include a constant of integration. int(x^2-6*x+1/x^5,x); If the integration fails, the original expression is returned. int(cos(cos(x)),x); To do a definite integral one simply adds a range for the variable. int(cos(x/4),x=-2..2); If there is not a closed form integral, one can use evalf to get a numerical approximation. evalf(int(cos(cos(x)),x=-2..2));
<Text-field style="Heading 1" layout="Heading 1">Solving and plotting differential equations</Text-field> One can easily solve many differential equations with Maple.
<Text-field style="_cstyle5" font_style_name="_cstyle5" superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]" layout="_pstyle4" alignment="left" firstindent="0" spacebelow="0" linebreak="space" rightmargin="0" bulletsuffix="" pagebreak-before="false" leftmargin="0" linespacing="0.0" initial="0" layout_style_name="_pstyle4" spaceabove="0" bullet="none">Load the <Hyperlink linktarget="Help:DEtools" hyperlink="true"><Font font_style_name="_cstyle6" superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" style="_cstyle6" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">DEtools</Font></Hyperlink> and <Hyperlink linktarget="Help:plots" hyperlink="true"><Font font_style_name="_cstyle6" superscript="false" placeholder="false" executable="false" selection-placeholder="false" italic="false" size="12" bold="false" style="_cstyle6" subscript="false" family="Times New Roman" opaque="false" underline="false" background="[255,255,255]" readonly="false" foreground="[0,0,0]">plots</Font></Hyperlink> Packages</Text-field> restart; with(DEtools): with(plots):
Here is the solution to LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYtLUkmbWZyYWNHRiQ2KC1JI21vR0YkNi1RMCZEaWZmZXJlbnRpYWxEO0YnLyUsbWF0aHZhcmlhbnRHUSdub3JtYWxGJy8lJmZlbmNlR1EmdW5zZXRGJy8lKnNlcGFyYXRvckdGNy8lKXN0cmV0Y2h5R0Y3LyUqc3ltbWV0cmljR0Y3LyUobGFyZ2VvcEdGNy8lLm1vdmFibGVsaW1pdHNHRjcvJSdhY2NlbnRHRjcvJSdsc3BhY2VHUSYwLjBlbUYnLyUncnNwYWNlR0ZGLUYjNiktSSNtaUdGJDYjUSFGJ0YuLUknbXNwYWNlR0YkNiYvJSdoZWlnaHRHUSYwLjBleEYnLyUmd2lkdGhHUSYwLjJlbUYnLyUmZGVwdGhHRlQvJSpsaW5lYnJlYWtHUSVhdXRvRidGSy1GTDYnUSJ4RicvJSdpdGFsaWNHUSV0cnVlRicvJStmb3JlZ3JvdW5kR1EsWzIwMCwwLDIwMF1GJy8lLHBsYWNlaG9sZGVyR0Zcby9GM1EnaXRhbGljRidGS0YyLyUubGluZXRoaWNrbmVzc0dRIjFGJy8lK2Rlbm9tYWxpZ25HUSdjZW50ZXJGJy8lKW51bWFsaWduR0Zpby8lKWJldmVsbGVkR1EmZmFsc2VGJy1GLzYtUSJ+RidGMi9GNkZecC9GOUZecC9GO0ZecC9GPUZecC9GP0ZecC9GQUZecC9GQ0ZecEZERkctRkw2JVEieUYnRmpuRmJvLUYvNi1RIj1GJ0YyRmJwRmNwRmRwRmVwRmZwRmdwRmhwL0ZFUSwwLjI3Nzc3NzhlbUYnL0ZIRmBxRl9wLUZMNiVGaW5Gam5GYm8tRi82LVEnJnNkb3Q7RidGMkZicEZjcEZkcEZlcEZmcEZncEZocEZERkdGaXAtRi82LVEqJnVtaW51czA7RidGMkZicEZjcEZkcEZlcEZmcEZncEZocC9GRVEsMC4yMjIyMjIyZW1GJy9GSEZbckZicUYy. DE_A := diff(y(x),x)=x*y(x)-x; dsolve(DE_A); Note that you must make the dependent variable a function of the independent variable. One can find out what type of differential equation one has using the odeadvisor. odeadvisor(DE_A); One can also try to see how Maple solves the differential equation using infolevel. infolevel[dsolve]:=2; dsolve(DE_A); In order to see solutions one can use the DEplot command. infolevel[dsolve]:=0: DEplot(DE_A,y(x),x=-4..4,y=-100..100,[[0,0],[0,1],[0,-1],[0,3],[0,-3]], linecolor=[blue,cyan,orange,black,green],thickness=2, stepsize=0.04);
<Text-field style="Heading 1" layout="Heading 1">The Quiz</Text-field> For each of the following, write commands . The answers are not unique. Write your answers in a new file and include the name(s) of your team-mates. You may print your quiz if it will fit on a single page. (a) Find the derivative of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2JlEkc2VjRicvJSVzaXplR1EjMThGJy8lJ2l0YWxpY0dRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ25vcm1hbEYnLUkobWZlbmNlZEdGJDYlLUYjNiotSSVt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