{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 0 2 2 2 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R 3 Font 0" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 24 0 0 0 0 2 1 2 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 2" -1 257 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 0 2 1 2 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 3" -1 258 1 {CSTYLE "" -1 -1 "Helvetica" 1 18 0 0 0 0 2 1 2 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 4" -1 259 1 {CSTYLE "" -1 -1 "Times" 1 16 0 0 0 0 2 2 2 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 64 " \+ An Introduction to Maple" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 26 "\nBasic Mechanics of Maple:" }} {PARA 0 "" 0 "" {TEXT -1 517 "\n1) Every command must end with a semi -colon or a colon. The semi-colon results in the out put being displa yed while the colon suppresses the output.\n2) The arithmetic operator s are the standard +,-,*,/,^. Parentheses are used for grouping.\n3) \+ \" refers to the last output, \"\" to the output 2 back, and \"\"\" th e output 3 back.\n4) Maple is an extremely high precision calculator. It does both floating \npoint (decimal) and integer calculations to \+ arbitrarily high precsions.\n\nLet's begin by doing some arithmetic. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "2*3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "2*3:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "23*(1-5^6)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "\";" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 7 "23^123;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "23 /567;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(\");" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 234 "\nNote that the fraction 23/567 can be c onverted to floating point form using the evalf command. Maple tries \+ to maintain the data type of the input. If desired one can set Maple t o calculate decimals to very a large number of digits.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "Digits:=100;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "evalf(223/12323);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 133 "\nSince 100 digits seems like overkill and wil bog down future calculations, you should reset Digits back to its default value of 10 .\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "Digits:=10;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 21 "\nAssig nment and Names" }}{PARA 0 "" 0 "" {TEXT -1 193 "\n\nYou can assign na mes to anything in Maple. This is quite useful in that it allows easy access to previously computes values. The assignment operator is : = not = so be careful.\n " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "h:=23*89;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "h^2;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "34/(12+2.34);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "k:=\";" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "c:=a*b;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "a:=3;b:= 9;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "c;" }}{PARA 0 "" 0 "" {TEXT -1 191 "The assignment c=a*b defines c in terms of the undefined names a and b. Once a and b are defined then the defintion of c is given i n terms of these. Then, if a and/or b change, so will c.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "a:=15;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "c;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "a:=d+e;" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 2 "c;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "a:='a'; b:= 'b';" }}{PARA 0 "" 0 "" {TEXT -1 61 "\nNote that more than one command can be entered at a prompt.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "c; " }}{PARA 0 "" 0 "" {TEXT -1 279 "The next to last line \"undefined\" \+ the values for a and b. \n\nMaple has the rule that all expressions a re \"fully evaluated\". To see what this means, consider the following sequence of assignments which are similar to the ones above. The dif ference is in the order of definition.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "a1:=2; b1:=3;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "c1:=a1*b1;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "a1:=100;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "c1;" }} {PARA 0 "" 0 "" {TEXT -1 206 "This time, c1 does not change its value even though a1 has changed. This is because when c1 was defined, Ma ple fully evaluated the expression c1:=a1*b1. It used the values of \+ a1 and b1 to define c1. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} {PARA 257 "" 0 "" {TEXT -1 48 "\nElementary Mathematical Functions and Constants" }}{PARA 0 "" 0 "" {TEXT -1 236 "\n\nMaple has all the stan dard mathematical functions such as sin, cos,exp, etc. It also has a large library of less well-known functions such as the Bessel functio ns. Maple also has several of the standard constants already defined. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "sin(0);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "sin(3);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(\") ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "sin(3.);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "exp(2*Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "ln(E);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 418 "Note that sin(3) is returned as itself and needs to be \"evalf ed\". Other, more well-known values such as sin(0) or ln(E), are ret urned in their simpest form. This is because the argument was entered \+ as an integer and by default, Maple leaves the output unevaluated. An alternative to using evalf is to enter the argument as a floating po int number. This generally forces to Maple to return a floating point \+ number.\n" }}{PARA 257 "" 0 "" {TEXT -1 26 "\nExpressions and Function s" }}{PARA 0 "" 0 "" {TEXT -1 178 "\nYou will certainly want define \+ complicated expressions and functions. Maple has several ways to crea te objects which are function-like. The simplest is called an express ion." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "f:=x^2-4*x+3;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 110 "\nHere, f is just a label on an algebraic expression. To evaluate f at, say, \+ x=2, one could do the follwing.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "f;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x:='x';" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 227 "\nThis is not the best way to evaluate the expression f \+ at x =2. One reason is that the value for x is defined and thus needs to be undefined. A better way is to use the subs command. Note the u se of the = not the :=.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "subs(x=2,f);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "subs(x= 1234567,f);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "subs(x=a+b,f );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 153 "Maple has extensive algebraic capabilities. Although it isn't important to know how to use these for now, a few of the commands ar e demonstrated here.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "expand(\" );" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(\");" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "f2:=\";" }}{PARA 0 "" 0 "" {TEXT -1 337 " \n If one wants to know more about factor or expand or any Maple comma nd, there is a very nice online help facility. One can either 1) use the help menu (upper right corner of this window) which activates a b rowser or 2) use ?keyword at the prompt. Either one pops up a window \+ containing information, examples, and related commands. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "?expand" }}{PARA 0 "" 0 "" {TEXT -1 147 " \n Back to defining expressions. Consider f defined above. A natural , although incorrect, way to try to evaluate f at x=2 is to do the fol lowing.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "f(2);" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 40 "Trying the following i sn't the answer.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f:='f';" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "f(x):=x^2+4*x+3;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "f(2);" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 25 "\nProcedures and Functions" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 251 "To handle the form f(2) \+ or f(123) or whatever, you will need to use a procedure. There are se veral ways to define these. The simplest is the following which invo lves the arrow operator. We'll use a new name so we don't lose the d efinition of f. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "g:=x->x^2-4*x +3;" }}{PARA 0 "" 0 "" {TEXT -1 209 "\nIn this format, g is the name o f a procedure which takes a value and computes the value above. The \+ variable x is actually just a \"dummy variable\" i.e. it has meaning o nly inside the body of this procedure.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "g(13);" }}{PARA 0 "" 0 "" {TEXT -1 38 "\nThe variable \+ x is still not defined.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x;" }} {PARA 0 "" 0 "" {TEXT -1 43 "\nAsking for g(x) results in an expressio n.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "g(x);" }}{PARA 0 "" 0 "" {TEXT -1 45 "\nProcedures allow you to compose functions. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "g(g(3));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "g(g(g(g(x))));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 129 "The output is ra ther complicated in this case. Maple tried to simplify its appearence by using %1 to stand for a subexpression." }}{PARA 0 "" 0 "" {TEXT -1 84 "\n\n\nA more general and powerful way to define a procedure is via the proc command.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "h:=pro c(x) x^2-4*x+2 end;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "h(3);" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 213 "This app ears to work just like the arrow operator. In this case they are in f act equivalent. However, in general, the proc command is much more p owerful. For example, it allows piece-wise defined functions.\n" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "h2:=proc(x) if x < 0 then x^2 else \+ sin(x) fi end;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "h2(-1);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "h2(3);" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 93 "Both the arrow operator and the proc comm and can handle functions of more than one variable.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "f:=(x,y)->x+y^2;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f(2,1);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "f(1,a+b);" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 27 "\nSets, Lists, and Sequences" }}{PARA 0 "" 0 "" {TEXT -1 206 "\nSo far you ha ve seen at least three distinct Maple data types: 1) numeric 2) expres sion and 3) proceedure. Three more data types which will be important \+ are sequences, lists, and sets. \n\nFirst a sequence\n" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 15 "sq1:=1,2,3,4,4;" }}{PARA 0 "" 0 "" {TEXT -1 9 "\nA list.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "ls1:=[1,2,3,4,2];" }}{PARA 0 "" 0 "" {TEXT -1 8 "\nA set.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "st1:=\{1,2,3,4,3\};" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 339 "Note that a set does not have any repe itions while a list can have repeitions. Both lists and sets have s \+ sequence as their base. The operator seq is a means of creating ind exed sequences and can be used to create lists, sets, and sequences. \+ Note that the elements do not have to be numbers. They can be any dat a type whatsoever. \n " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "sq2:=seq( x^i,i=1..4);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "ls2:=[seq((x+1)^i,i =1..4)];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "st2:=\{seq(sin(i*Pi*x), i=1..4)\};" }}{PARA 0 "" 0 "" {TEXT -1 166 "\nOnce a sequence, set, or list is created, its elements can be accessed very easily. For examp les, suppose you wanted the third element of each of the three above. \+ \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "sq2[3];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "ls2[3];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "st2[3];" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 9 "\nPlot ting" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 149 " We will of course want to be able to plot expressions and functions. \+ This is easy.\nThe plot appears in a window outside the Maple session \+ window. \n " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "f:=x^2-3*x+1;" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "plot(f,x=-1..2);" }}{PARA 0 "" 0 " " {TEXT -1 530 "\nIn the plot window, you will notice all sorts of men u options. These allow you to vary the characteristics of the plot di splay. For example, you can change the axes or plot only the points. Under the \"file\" menu, you will find one option for printing the p lot to a file which can then be printed on a laser printer. The other option under \"file\" gets rid of the plot window. \n\nPlotting a pr oceedure is also easy. One must be a little more careful however. Th e first two plot commands are fine but the third doesn't work.\n" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "g:=x->2*sin(x^2)+1;" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 19 "plot(g(x),x=-1..2);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "plot(g,-1..2);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 " plot(g,x=-1..2);" }}{PARA 0 "" 0 "" {TEXT -1 480 "\nThe last attempt a t a plot doesn't work because the variable x has no meaning to g even \+ though it appeared in the body of g. It is really just a dummy meanin g with no extrinsic meaning. The second form is the generic way to pl ot a proceedure. The first form works because g(x), after evaluation, is an expression with an explicit appearance of x in it.\n\nPlots wit h multiple graphs are possible. One way to do this is to replace th e single function with a set of functions.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "plot(\{x,x^2,x^3\},x=0..1);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "plot(\{seq(x^i,i=1..10)\},x=0..1);" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 325 "Plots can be combined \+ via the display command. To do so, give a plot a name just like it w ere a number or expression.\n\nBegin by generating a plot and afterwar ds give it a name. Note the use of the colon to supress the output. \+ If you are interested in what the output of aplot looks like, change t he colon to a semicolon.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "plot( sin(x),x=-Pi..Pi);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "p1:=\":" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 147 "\nNext, lets generate a second pl ot. In this case we'll name it at the same time its calculated. Agai n, we'll use a colon to terminate the input\n." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "p2:=plot(sin(2*x),x=-Pi..Pi):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 72 "\nTo combine the two plot structures p1 and p2, use \+ the display command.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "display( \{p1,p2\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 199 "\nThere are many \+ different ways to plot things in Maple. One can create 3-dimensional \+ plots, parametric plots, and plots of lists of points. For more inf ormation, check out the help command ?plot." }}{PARA 0 "" 0 "" {TEXT -1 35 "\nFirst a plot in three dimensions.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "plot3d(x^2*exp(-y^2-x*2),x=0..1,y=0..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "\nNext, a parametric curve in two dimensi ons.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "plot([sin(t),cos(t),t=0.. 2*Pi]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 182 "\nLet's now generate \+ a list of points to plot. Take note of the structure, its a list of 1 01 elements in which each element is a list of two elements (represent ing an ordered pair).\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "ls:=[seq ([i/11,sin(Pi*i/11)],i=0..100)]:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot(ls,style=point);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 43 "\nCalculus: Differentia tion and Integration." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 102 "Calculus and Maple get along quite nicely. Maple can differentiate and integrate with relative ease.\n" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 14 "f:=x^2*sin(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "diff(f,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "diff(\",x);" }}{PARA 0 "" 0 "" {TEXT -1 137 "\nThis is of course t he second derivative of f with respect to x. There at least two diff erent ways to get this using a single command.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "diff(f,x,x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "di ff(f,x$2);" }}{PARA 0 "" 0 "" {TEXT -1 53 "\nNow lets check this by i ntegrating a couple times.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "int( \",x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "int(\",x);" }} {PARA 0 "" 0 "" {TEXT -1 55 "\nHere's the syntax for calculating defin ite integrals.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "int(f,x=0..Pi); " }}{PARA 0 "" 0 "" {TEXT -1 150 "\nMaple actually computes partial de rivatives with respect to a specified variable. For example, one cou ld try to differentiate f with respect to y.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "diff(f,y);" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 91 "Let's define an expression with more than one v ariable and differentiate it a few times. .\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "f2:=(x^2+3*y)*sin(x+y);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "diff(f2,y);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "dif f(f2,x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "diff(f2,x,y);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "diff(f2,y,x);" }}{PARA 0 "" 0 "" {TEXT -1 167 "The last two lines are evidence that the order of differentiat ion for mixed partials does not matter for \"nice\" functions. \n\nMap le also can differentiate symbolically." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "diff(u(t),t);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "diff(u(v(t )),t);" }}{PARA 0 "" 0 "" {TEXT -1 166 "This is Maple's way of display ing the chain rule. D(u) is the the derivative of the function u. It also knows the product rule and the quotient rule. For example:\n" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "diff(u(t)*v(t),t);" }}{PARA 0 "" 0 "" {TEXT -1 301 "\n\n\nMaple will differentiate just about any expre ssion you can type in. The situation is a bit more complicated when i t comes to integration. A great many functions simply do not have elem entary anti-derivatives. If given such a function Maple will grind aw ay for a while and then just spit it back.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "f:=sin(x^2)/(1+x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "int(f,x=0..2);" }}{PARA 0 "" 0 "" {TEXT -1 131 "\nThis is Maple's \+ way of saying \"uncle\". If the value of this integral is what you wa nt, then Maple will evaluate it numerically. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(\");" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 377 "\n This re-enforces the idea that the definite integral represents a nu mber even if one cannot find an elementary anti-derivative. Consider \+ the following example. The use of Int rather than int tells Maple not to even bother looking for an antiderivative. Instead we'll just eva luate it numerically. This allows you to define a function which is t he antiderivative of f. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "f2:= x1->evalf(Int(f,x=0..x1));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "f2(2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "plot(f2,0..4); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 251 "Suppose you wanted to compare the plot of f2 with that of f. Sin ce f2 is a procedure and f is an expression, it isn't possible to do i t with a single plot command. However, you can generate another plot \+ of f and then combine the two using display.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "p1:=\":" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "p2:=plot (f,x=0..4):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "display(\{p1,p2\}); " }}{PARA 0 "" 0 "" {TEXT -1 317 "\nCan you tell which one is the der ivative of the other?\n\nOn a color monitor, you can control the color of your plots. This is a useful way of discriminating between differ ent plots after they are combined. You can redo the above so that the color of the antiderivative is red and the color the derivative is bl ue.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "p3:=plot(f2,0..4,color=red ):\np4:=plot(f,x=0..4,color=blue):\ndisplay(\{p3,p4\});" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 " " {TEXT -1 18 "Solving Equations\n" }}{PARA 0 "" 0 "" {TEXT -1 345 "\n Maple has an extremely powerful equation solver at your disposal. It \+ can solve single equations, simultanious systems of linear equations a nd even systems of nonlinear equations. It can (try to) solve the equ ations exactly or numerically.\n\nWe begin with a simple example. Aft er solving we'll substitute the solution back in just as a check.\n" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "f:=x^2-4*x+3;" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 13 "solve(f=0,x);" }}{PARA 0 "" 0 "" {TEXT -1 66 "\nGiv e the output a name. In this case, the output is a sequence.\n" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "sols:=\";" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 88 "\nTo see if the first element of the sequence is actual ly a solution, do the following. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "subs(x=sols[1],f);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "\nLets \+ try a more complicated example.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "f:=x^2+sin(x)*x-3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "s olve(f=0,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 276 "\nThe lack of an output indicates that Maple can't solve this explicitly for x. In \+ this case, we need to solve it numerically using the fsolve command. \+ Using fsolve is tricky. It will almost always return one (approximate ) solution but usually not all of the solutions.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "sol:=fsolve(f=0,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 229 "\nThe best way to see if there are more solutions is to \+ look at a plot of f. The additional argument to the plot command lim its the y range. A glance at the plot reveals that there is at least \+ one more solution near -2 or so.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "plot(f,x=-5..5,y=-1..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 72 "Use fsolve again, only this time tell i t to look in the range x=-2..-1.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "fsolve(f=0,x=-2..-1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 97 "\nNo w add this solution to the solution above. The effect is to create a \+ sequence of solutions. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "sol:=s ol,\";" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "subs(x=sol[2],f);" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(\");" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 216 "Maple is quite adept w ith linear systems of equations. To simplify things, each equation ca n be given a name. (Note: more than one line can be entered at a pro mpt by using the shift-return to separate the lines);\n" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 30 "eq1:=4*x-9*y=1;\neq2:=-x+2*y=2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "solve(\{eq1,eq2\},\{x,y\});" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 112 "\nThe assign command does what it should, it takes a set of like the one above and does the obvious ass ignments.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "assign(\");" }} {PARA 0 "" 0 "" {TEXT -1 33 "Now take a peek at eq1 and eq2. " }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "eq1;\neq2;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "x,y;" }}{PARA 0 "" 0 "" {TEXT -1 58 "\nRemember to \"undefine\" x and y before going any furth er!\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "x:='x';y:='y';" }}{PARA 0 "" 0 "" {TEXT -1 31 "\nLets try a nonlinear example.\n" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 25 "eq3:=2*x^2-5*x*y+3*y^2=2;" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 23 "solve(\{eq2,eq3\},\{x,y\});" }}{PARA 0 "" 0 "" {TEXT -1 161 "\nThis is saying that the solutions to the system are de fined in terms of the roots of a quadratic polynomial z^2-6*z+6. To c onvert to numerical form use evalf.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "sol:=evalf(\");" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 177 "\nThis \+ gives one pair of solutions. There should be two pair. Lets You ca n check by looking at a plot. A plot of the nonlinear equation can be \+ obtained using implicitplot. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "implicitplot(\{eq2,eq3\},x=-10..10,y=-10..10);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 312 "\nLooking at this plot makes it convincing that we \+ have found only one of the two pairs of solutions to this system. (No te: The coordinates of a point on a plot can be obtained by holding t he mouse down in the plot window). The option maxsols=2 tells fsolve \+ to keep looking until it finds at most 2 solutions.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "sols:=fsolve(\{eq2,eq3\},\{x,y\},maxsols=2);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT -1 43 "Editt ing and getting around in the windows." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 1274 "Maple is very mouse/cursor oriented . You do not have to retype commands to re-enter them. You can just \+ reposition the mouse on the input line and hit return. Also, there is a cut/copy/paste faciilty which is similar to a Macintosh's. Ther e is a scroll bar on the right side which moves you up and down the wi ndow. Most mouse action is controled by the left mouse button. \n\nY our Maple work can be saved in several different formats. The menu \+ \"file\" of the main window has several options for saving your work. You can save your work in two different ways. First to save it as a maple session using Save As or Save . An alternative is to save it as a text file using Export as Text. The advantage of the former is \+ that is preserves the nice interface you see here. In this form, howe ver, you cannot open or edit the file using other editors such vi, em acs, or xedit. \nThe text file option overcomes this difficulty but it loses the nice interface. In either case, the file can be read back \+ into a Maple session using either Open or Import Text (or include). \+ You should experiment with these to get a feel for how they work. \n\n For larger projects, you will want to use an editor to create your co mmand files. There will more about this in the future. " }}}}{MARK " 0 4 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }