INTRODUCTION TO MAPLE
<Text-field layout="Heading 1260" style="Heading 1260"><Font executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" size="18" style="_cstyle330" underline="false">How to get around a MAPLE worksheet: </Font><Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" style="_cstyle350" underline="false">Just execute the statements in red and observe the results</Font><Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" size="18" style="_cstyle351" underline="false">.</Font></Text-field>solve(x+2=5);Now try again with a colon instead of a semicolon.solve(x+2=5):Maple did solve the equation but the colon indicates that you didn't want to be bothered with the result.
<Text-field layout="Heading 1" style="Heading 1">The on-screen help utility</Text-field>Most users of modern software packages never will buy reference books but rather entirely (or primarily) rely on the on-screen-help.Try clicking on the on-screen help in the MAPLE window.The alternative is type ? keyword (in an input region), and execute by hitting the ENTER key, see the example below.?solve
<Text-field layout="Heading 1260" style="_cstyle329"><Font family="Times New Roman" foreground="[0,0,0]" italic="false" size="18" underline="false">MAPLE basics</Font></Text-field>MAPLE is a package for SYMBOLIC ALGEBRA, that ALSO can do the usual numerical calculations, and produce first rate graphical output.
<Text-field layout="Heading 2261" style="_cstyle328"><Font family="Times New Roman" foreground="[0,0,0]" italic="false" size="14" underline="false">MAPLE algebra</Font></Text-field>Execute the following examples (with or withouth modification), and observe the outputs.Move the cursor to the next input area, and repeatedly hit the ENTER KEY until you reach the end of this section.Each statement needs to be closed with a semi-colon (or a colon) before MAPLE will execute it. Omitting this semi-colon is the most frequent cause for trouble.restart; #Clears evarything from memoryMaple uses the standard symbols for arithmetic: +,-,* (for multiplication), /, and ^ (for exponentiation).2/7-1/9;3+4; 2^10*3^12/(6^6*10!);evalf(%); #Evaluates the most previous result as a floating point (decimal) numberThe statements can also be nested for efficiency.evalf(2^10*3^12/(6^6*10!));Maple also knows all the standard functions; sin(x), cosh(x), ln(x) (to Maple log(x) is ln(x)), exp(x) and so on;help(index);We can name objects in Maple for later use just as we name a variable in mathematics.Use the form name:=value.m:=2;n:=3;m*n;Of course, equations can be solved for a variable with the statement solve.soln:=solve(x^2+x=3);To list each solution separately trysoln[1];soln[2];Now get a decimal answerevalf(soln);The default number of digits after the dot is 10. To change this number forexample to 20 we writeevalf(soln,20);Notice the difference between the := (assignment) and the = (logical equality) inabove statement. Do not confuse them!solve(a+b*c=d,b);Notice in the above equation we have specified the variable to be solved for.MAPLE is case-sensitive:evalf(Pi); # Gives a numeric valueevalf(pi); Multiplication has to be denoted explicitly by * , i.e. juxtaposition does not work.x:=3;y:=2;x * y - xy;Indeed in this case xy is a new variable, just like "x1" or "vol".Complicated expressions can be manipulated with simplify and expand:simplify((t^2-1)/(t-1)^2);expand((t+1)^2/(t-1)^2);NOTICE: To use NiMpJSJlRyUieEc= , input, not e^xexp(x);e^x;Maple reads the first one correctly, the second one as some unknown variable.
<Text-field layout="Heading 2" style="Heading 2">Plotting with MAPLE</Text-field>Let's look at some basic plotting. To begin enter an expression and tag it with the name f. The assignment operator is the := operator. Note that you have not created a function in the mathematical sense. The notation f(2) will not be recognized by Maple with the assignment made here (more details on this will follow).restart;f:=x^2;plot(f);No domain was given. Hence, no graph. The correct syntax for the plot command:plot(f,x=-3..3);To gain control over the vertical scale, use a second range in the plot command.Maple interprets the first range as the horizontal scale and the second range as the vertical.plot(f,x=-3..3,y=-1..15);Now suppose we want to examine the intersection of some simple curves and calculate the points of intersection. Enter a second "function" g.g:=7+3*x-5*x^2;Plot both functions on one set of axes to see what to expect for intersections.plot({f,g},x=-3..3);There are two intersections points to compute, and the x-coordinates of each point has magnitude of about one. To compute the points exactly, we can set f and g equal and solve for x.q:=solve(f=g,x);The solve command has returned an expression sequence containing the two roots, listed in sequence.q[1];q[2];Now let's see how to obtain the y-coordinates corresponding to the two x-coordinates just calculated. Note that mathematically you would "plug in" or substitute the x-value into the appropriate expression.y1:=subs(x=q[1],f);"subs" stands for "substitute". The statement means: -substitute x=q[1] in f-.y2:=subs(x=q[2],f);Obviously, there is a need for some simplification. Two options come to mind.We can try to expand the expression for y1 and y2, or we can try to simplify these expressions.simplify(y1);expand(y1);The more natural action is to expand the term being squared. Hence, the expand command produced the more appropriate result.To plot more than one function, use the following syntax.plot({x^2,x+1},x=-5..5,y=-5..5);To plot something which is input as a function, use the following statements.f:=x->x^2-1:plot(f(x),x=-5..5,y=-2..5,thickness=3,color=blue,scaling=constrained);The statements following the y range are some of the plot options available to see all of them, input?plot[options]scaling=constrained, gives a 1 to 1 ratio between the distances on the x and y axes.
<Text-field layout="Heading 2261" style="_cstyle325"><Font family="Times New Roman" foreground="[0,0,0]" italic="false" size="14" underline="false">Defining functions in MAPLE</Font></Text-field>In Maple, just as in mathematics, there is a distinction between an expression and a function.To help you remember, think: a function takes arguments and returns values, an expression is an object. That is, a function is active and an expression is passive.There are different ways to define a function in MAPLE. The main two are the following.1. The "arrow" definition: name:=variables -> expressionf:=x->x^2;Then we can find f(2), f(0), etc.f(2);2. The "procedure" definition: name:=proc(variable) expression; end;g:=proc(x) x^2; end;g(2);The procedure definition is useful when we need to define very complicated functions whose definition requires more than one line commands.Now let's explore a little bit more the difference between a function and an expression:expr:=x^2;subs(x=2,expr);To evaluate the expression at x=2 we need to use the command "subs" (substitute). Typing expr(2) does not work.To turn a function into an expression, just apply it:y:=f(x);To turn an expression into a function, do the "opposite" of applying the function:h:=unapply(expr,x);h(2);
<Text-field layout="Heading 1260" style="Heading 1260"> <Font executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" size="18" style="_cstyle326" underline="false">EXERCISES</Font></Text-field>Work through the following basic problems in algebra and plotting.
<Text-field layout="Heading 2261" style="_cstyle327"><Font family="Times New Roman" foreground="[0,0,0]" italic="false" size="14" underline="false">ALGEBRA</Font></Text-field>1. Reduce the fraction NiMqJiwoKiQlInhHIiIjIiIiKiYiIiZGKEYmRighIiIiIidGKEYoLCZGJkYoRidGK0Yr2. Factor NiMsKCokJSJ4RyIiIyIiIkYlRiciIichIiI= 3. Expand NiMqJiwmJSJ4RyIiIiIiJEYmRiYsJkYlRiYiIiMhIiJGJg== 4. Solve the equation NiMvLCoqJCUieEciIiQiIiIqJiIiJUYoKiRGJiIiI0YoISIiKiZGLEYoRiZGKEYtRidGKCIiIQ== 5. Solve the equation NiMvLCgqJCUieEciIiMiIiIqKCIiJEYoRiZGKCUieUdGKCEiIiokRitGJ0YoRic= for y. 6. For the function NiMvLSUiZkc2IyUieEcsJiokRiciIiMiIiIiIiQhIiI= , find f (4) and f (n+1).7. Evaluate NiMtJSRzdW1HNiQqJiIiIkYnKiQlIm5HIiIjISIiL0YpO0YnIiQrIg==
<Text-field layout="Heading 2" style="Heading 2">PLOTTING</Text-field>1. Plot NiMvLSUiZkc2IyUieEcsJiIiJSIiIiokRiciIiMhIiI= and NiMvLSUiZkc2IyUieEcsJkYnIiIiIiIkRik= on the same set of axes and find their points of intersection.2. Plot NiMvLSUiZkc2IyUieEctJSRleHBHRiY= and NiMvLSUiZkc2IyUieEcqJEYnIiIj and find their points of intersection.
<Text-field layout="Heading 1" style="Heading 1">Common Errors</Text-field>Forgetting the terminating semicolon. Maple is very patient and will wait forever for the semicolon.Forgetting parenthesis for functions. For example simplify 1/x+3/x^2 should be simplify(1/x+3/x^2).Typing a comma for a period or viceversa. For example, plot(f,0.,10) for plot(f,0..10).Forgetting to put in all the multiplications. For example, x y gives the dreaded syntax error.Two operators in a row need parentheses. For example, 10^-2 must be entered as 10^(-2).Recursively defining a new name. For example, x:=x+1 if x had no previous value. The next time Maple sees x it gives the error Error, stack overflow. This is equivalent to a dictionary definition that reads: blue: see blue.When plotting expressions, you must specify a variable in the range. For example, plot(sin(x),-1..1) is wrong; use plot(sin(x),x=-1..1).Finally, remember that Maple executes commands as they are entered and not necessarily as they are ordered in the worksheet. For example the following statements are valid as long as the second one is entered before the first one. Try first entering the first one then the second one (what happens?) instead.x:=x+1;x:=2;