155
A Guide to Maple 8 & 9 Commands for Calculus I, II & III By Dr. Jennifer Bergner Dr. Don Spickler Department of Mathematics and Computer Science Salisbury University Copyright ©2003

Maple Guide

Embed Size (px)

DESCRIPTION

Guía de calculo con maple

Citation preview

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    By

    Dr. Jennifer Bergner Dr. Don Spickler

    Department of Mathematics and Computer Science Salisbury University

    Copyright 2003

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    1

    Table of Contents

    Introduction................................................................................................................... 4

    Basic Commands & Concepts....................................................................................... 5 Exact verses Approximate Solutions............................................................................ 5 Obtaining Previous Results, The Ditto Operator .......................................................... 5 Expressions ................................................................................................................. 6 Setting a Variable to a Value ....................................................................................... 7 Setting a Variable Back to a Variable .......................................................................... 8 Defining a List and a Set ............................................................................................. 9 The seq Command..................................................................................................... 10 The evalf Command .................................................................................................. 12 The eval Command ................................................................................................... 13 The subs Command ................................................................................................... 15 Mathematical Functions ............................................................................................ 16

    Trigonometric and Hyperbolic Functions............................................................... 16 Exponential and Logarithmic Functions................................................................. 17 Root Functions ...................................................................................................... 17 Other Functions..................................................................................................... 17

    The solve Command.................................................................................................. 17 The fsolve Command ................................................................................................ 20

    Functions ..................................................................................................................... 24 Defining a Function of a Single Variable ................................................................... 24 Using the map Command .......................................................................................... 24 Defining Piecewise Functions ................................................................................... 25 Defining a Function of Several Variables .................................................................. 27

    Limits, Differentiation, Integration & Sums.............................................................. 29 Evaluating Limits of Function of a Single Variable ................................................... 29 Evaluating Limits of Multivariable Functions............................................................ 30 Derivatives of Functions of a Single Variable............................................................ 32 Partial Derivatives of Multivariable Functions........................................................... 35 Integration of Single Variable Functions ................................................................... 39 Integration of Multivariable Functions....................................................................... 40 Finite and Infinite Sums ............................................................................................ 43 The taylor Command................................................................................................. 46

    Graphing ..................................................................................................................... 48 Two Dimensional Plots ............................................................................................. 48

    The plot Command: Plotting Functions.................................................................. 48 The plot Command: Plotting Parametrically Defined Equations............................. 54 The implicitplot Command .................................................................................... 55 The contourplot Command .................................................................................... 57

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    2

    The gradplot Command ......................................................................................... 58 The fieldplot Command......................................................................................... 60 Infinity Plots.......................................................................................................... 61 The logplot and loglogplot Commands .................................................................. 62 The arrow command.............................................................................................. 63 The display command............................................................................................ 66

    Three Dimensional Plots ........................................................................................... 66 The plot3d Command: Plotting Functions.............................................................. 66 The cylinderplot Command ................................................................................... 73 The sphereplot Command ...................................................................................... 74 The arrow Command ............................................................................................. 74 The fieldplot3d Command ..................................................................................... 77 The gradplot3d Command ..................................................................................... 78 The implicitplot3d Command ................................................................................ 79 The spacecurve Command..................................................................................... 80 The display Command........................................................................................... 81

    Packages ...................................................................................................................... 83 The student Package.................................................................................................. 83

    The changevar Command ...................................................................................... 84 The distance Command ......................................................................................... 85 The intercept Command ........................................................................................ 85 The leftbox, leftsum, rightbox, rightsum, middlebox and middlesum Commands .. 86 The midpoint Command ........................................................................................ 89 The showtangent Command .................................................................................. 89 The trapezoid and simpson Commands.................................................................. 90 The Lineint Command........................................................................................... 91

    The Student Package: Student[Calculus1] ................................................................. 92 The AntiderivativePlot Command ......................................................................... 92 The ApproximateInt Command ............................................................................. 93 The DerivativePlot Command ............................................................................... 98 The InversePlot Command .................................................................................... 99 The MeanValueTheorem Command .................................................................... 100 The NewtonsMethod Command .......................................................................... 101 The RiemannSum Command ............................................................................... 103 The RollesTheorem Command ............................................................................ 103 The SurfaceOfRevolution Command ................................................................... 103 The Tangent Command ....................................................................................... 105 The TaylorApproximation Command .................................................................. 106 The VolumeOfRevolution Command .................................................................. 108 The Asymptotes Command ................................................................................. 110 The CriticalPoints Command............................................................................... 111 The ExtremePoints Command ............................................................................. 111 The InflectionPoints Command ........................................................................... 112 The Roots Command ........................................................................................... 112

    The linalg Package .................................................................................................. 113 The LinearAlgebra Package .................................................................................... 114

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    3

    The VectorCalculus Package ................................................................................... 115 Defining a Vector................................................................................................ 116 The &x Operator and The CrossProduct Command ............................................ 117 The . Operator and The DotProduct Command .................................................... 117 The ArcLength Command ................................................................................... 118 The Binormal Command ..................................................................................... 119 The Curl Command ............................................................................................. 120 The Curvature Command .................................................................................... 120 The Del, Gradient and Nabla Commands............................................................. 122 The diff Command .............................................................................................. 123 The DirectionalDiff Command ............................................................................ 124 The Divergence Command .................................................................................. 125 The Flux Command............................................................................................. 126 The evalVF Command......................................................................................... 128 The int Command................................................................................................ 128 The Jacobian Command ...................................................................................... 131 The limit Command............................................................................................. 133 The LineInt Command......................................................................................... 133 The PathInt Command......................................................................................... 135 The PrincipalNormal Command .......................................................................... 137 The RadiusOfCurvature Command...................................................................... 138 The ScalarPotential Command............................................................................. 139 The SurfaceInt Command .................................................................................... 140 The TNBFrame Command .................................................................................. 140 The TangentLine Command ................................................................................ 142 The TangentPlane Command............................................................................... 142 The TangentVector Command............................................................................. 143 The Torsion Command........................................................................................ 144 The VectorPotential Command............................................................................ 145

    The plots Package ................................................................................................... 146 The plottools Package ............................................................................................. 146

    Animation.................................................................................................................. 150

    Using Maple Help...................................................................................................... 153

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    4

    Introduction

    This manual is a quick reference guide to some of the Maple 8 and 9 commands that are pertinent to Calculus I, II and III. It is designed to show you the syntax and examples for specific Maple functions. It is not designed to show you how to put the commands together to solve problems or to explain the ins and outs of Maple programming. With this guide and your mathematical background you should be able to use Maple to help solve more difficult problems and explore both the theory and applications involved in the Calculus sequence.

    The guide is organized by topic and is not to be read as a textbook. Many of the examples that are given in the early sections use commands that are covered later in the guide. While this may cause some mild frustration when you are first learning Maple, once you have a little Maple under your belt you will find the extent of the examples quite helpful.

    Most of the material in this guide can also be found in Maple documentation and the Maple Help System. In fact, both of these other resources offer a more complete description of the command, its attributes and applicable options. One of the difficulties with both the written and electronic help systems is that they are too complete. Most descriptions in the help system explain the command to its fullest extent and offer rather advanced examples. This guide concentrates on the way you will most likely use the commands in a Calculus course and leaves the advanced topics alone. Curious readers are certainly welcome to explore the help system for further explanations of the commands given in this guide and many commands that we do not cover.

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    5

    Basic Commands & Concepts

    Exact verses Approximate Solutions Maple is a computer algebra system, which means that it does symbol manipulation in the same way we do when solving a problem by hand. It will keep its answers in exact form whenever possible and in many cases you need to force it to give you an approximation. Maple has several built-in commands that will approximate a value, furthermore, there are some commands that have both exact and approximate forms. The approximate form usually has an f at the end of the command name.

    Obtaining Previous Results, The Ditto Operator In Maple, percentage signs are used to refer to previously computed expressions. Specifically, the % operator reevaluates the last expression computed, the %% operator reevaluates the second last expression computed, and the %%% operator reevaluates the third last expression computed. Be careful, the last expression is not always the one directly above the %, it is the last one done in the session. For example, if we execute the following commands in order, > x:=2;

    := x 2

    > y:=3; := y 3

    > z:=x+y; := z 5

    Then the following ditto commands will return the following values. > %;

    5

    > %%; 3

    > %%%; 2

    If we execute the same commands in reverse order then the following ditto commands will return the following values. > %;

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    6

    2

    > %%; 3

    > %%%; 5

    Expressions The syntax for mathematical expressions in Maple is quite similar to other programs like Excel and to most graphing calculators. The main thing to watch is that you must always use an * to denote multiplication. Otherwise, it is simply + for addition, for subtraction, * for multiplication, / for division, ^ for powers and we always use parentheses ( ) for grouping. Note that [ ] and { } have other uses in Maple. For example, > 3*x^2-2*x+7;

    - + 3 x2 2 x 7

    > 4^(x-2);

    4( )- + 2 x

    Maple will also give you an error if the expression you input is in some way ambiguous. For example, > x^x^x; Error, `^` unexpected

    > x^(x^x);

    x( )xx

    > (x^x)^x;

    ( )xxx

    As you know parentheses can make a big difference in the meaning of an expression. Note the difference in the following outputs. > (x^2-7*x+2)/(x+3);

    - + x2 7 x 2 + x 3

    > x^2-7*x+2/x+3;

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    7

    - + + x2 7 x2x

    3

    > x^2-7*x+2/(x+3);

    - + x2 7 x2

    + x 3

    Setting a Variable to a Value To set a variable to a value you simply start the command with the variable name followed by := and then the value or expression. For example, to define the variable x to be the number 5 we would use, > x:=5;

    := x 5

    To define the variable x to be the expression 72 -h we would use, > x:=2*h-7;

    := x - 2 h 7

    Caution: When you define a variable to be a particular value, every subsequence use of the variable results in the value being substituted automatically. For example, > f:=x->2*x^2+3*x-5;

    := f x + - 2 x2 3 x 5

    > x:=5; := x 5

    > 3*x; 15

    > f(x); 60

    > f(t); + - 2 t2 3 t 5

    > x:=2*h-7; := x - 2 h 7

    > f(x); + - 2 ( ) - 2 h 7 2 6 h 26

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    8

    To reset a variable back to a variable, without any value, start with the variable followed by the := followed by the variable in single quotes. For example, > x:='x';

    := x x

    > f(x); + - 2 x2 3 x 5

    Also, do not use this method to define a function, see the How To on defining functions. For example, if we wanted to define to define the function ( ) 532 2 -+= xxxf the command > f:=2*x^2+3*x-5;

    := f + - 2 x2 3 x 5

    Would not do the trick. It does define f to be the given expression but it does not view f as a function. Note the output of the following commands. > f;

    + - 2 x2 3 x 5

    > f(3); + - 2 ( )x 3 2 3 ( )x 3 5

    The correct way to define this function is by, > f:=x->2*x^2+3*x-5;

    := f x + - 2 x2 3 x 5

    > f(3); 22

    Setting a Variable Back to a Variable Often when a variable is set to an expression you will need to set it back to a variable. To reset a variable back to a variable, without any value, start with the variable followed by the := followed by the variable in single quotes. For example, > x:=5;

    := x 5

    > x;

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    9

    5

    > x:='x'; := x x

    > x; x

    Defining a List and a Set In many applications it is advantageous or even necessary to create a list or set of items. You need to be aware that there is a major difference between the two even though their syntax is very similar. To define a set we begin with the name of the set followed by := followed by a list of items in curly brackets separated by commas. For example, > t:={1,2,3,4,4,4,5,6};

    := t { }, , , , ,1 2 3 4 5 6

    > t; { }, , , , ,1 2 3 4 5 6

    > s:={x,y,t,w-2,3,4}; := s { }, , , , ,3 4 x y - w 2 t

    Notice that in a set duplicates are removed. We define a list in the same manner except that we use square brackets instead of curly brackets. Notice here that duplicates are not removed. > t:=[1,2,3,4,4,4,5,6];

    := t [ ], , , , , , ,1 2 3 4 4 4 5 6

    > t; [ ], , , , , , ,1 2 3 4 4 4 5 6

    Another difference between lists and sets that you may have noticed above is that a set may rearrange the order of the items whereas a list will not. For example, > t:={1,2,5,8,3,4,4,4,5,6,2,2,7};

    := t { }, , , , , , ,1 2 3 4 5 6 7 8

    > t; { }, , , , , , ,1 2 3 4 5 6 7 8

    > t:=[1,2,5,8,3,4,4,4,5,6,2,2,7]; := t [ ], , , , , , , , , , , ,1 2 5 8 3 4 4 4 5 6 2 2 7

    > t;

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    10

    [ ], , , , , , , , , , , ,1 2 5 8 3 4 4 4 5 6 2 2 7

    The seq Command The seq command is for creating a sequence of expressions or objects that are separated by commas. This makes the creation of special lists easy and quick. This command is also useful in the creation of animations. It can be used to create a sequence of images that can be pasted together with the display command. We will start with examples of non-images. The seq command has the following syntax,

    seq(expr, rng); where expr is the general expression that will change with a change in a variable value and rng is a range for that variable value. For example, > seq(n^2,n=1..20);

    , , , , , , , , , , , , , , , , , , ,1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400

    It is customary for the range to begin and end at integer values but it not necessary. In the following example we begin the sequence at 1.5. Note that this creates a sequence of halves until the point where the next number exceeds the ending value. > seq(n^2,n=1.5..10);

    , , , , , , , ,2.25 6.25 12.25 20.25 30.25 42.25 56.25 72.25 90.25

    We can create sequences of functional values as well. > f:=x->x^2-2*x+7;

    := f x - + x2 2 x 7

    > seq(f(t),t=-5..5); , , , , , , , , , ,42 31 22 15 10 7 6 7 10 15 22

    Another option of the seq command is that one can use a list instead of a range. For example the following command will do the same thing as the map command. > seq(f(t),t=[1,3/2,5.2,7,9.11235]);

    , , , ,6254

    23.64 42 71.81022252

    The seq command is great for defining lists. For example, say we are interested in creating a list of values to numerically examine the limit of a function. To create a list of inputs we would need to create a sequence of numbers that is approaching a particular

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    11

    number. For example, say that we wanted to create a sequence of numbers that approached 1 from above. One way to do it would be as follows. > seq(1+1/2^n,n=0..20);

    232

    54

    98

    1716

    3332

    6564

    129128

    257256

    513512

    10251024

    20492048

    40974096

    81938192

    1638516384

    3276932768

    6553765536

    , , , , , , , , , , , , , , , , ,

    131073131072

    262145262144

    524289524288

    10485771048576

    , , ,

    We can evalf the list to produce decimal approximations to these values. > evalf(seq(1+1/2^n,n=0..20)); 2. 1.500000000 1.250000000 1.125000000 1.062500000 1.031250000 1.015625000, , , , , , ,

    1.007812500 1.003906250 1.001953125 1.000976562 1.000488281 1.000244141, , , , , ,1.000122070 1.000061035 1.000030518 1.000015259 1.000007629 1.000003815, , , , , ,1.000001907 1.000000954,

    To create a list we simply need to place the seq command inside square brackets. > lst:=[evalf(seq(1+1/2^n,n=0..20))]; lst 2. 1.500000000 1.250000000 1.125000000 1.062500000 1.031250000, , , , , ,[ :=

    1.015625000 1.007812500 1.003906250 1.001953125 1.000976562 1.000488281, , , , , ,1.000244141 1.000122070 1.000061035 1.000030518 1.000015259 1.000007629, , , , , ,1.000003815 1.000001907 1.000000954, , ]

    To analyze the function we then define the function and use the map command on it and the list. > f:=x->(x^2-1)/(x-1);

    := f x - x2 1 - x 1

    > map(f,lst); 3.000000000 2.500000000 2.250000000 2.125000000 2.062500000 2.031249984, , , , , ,[

    2.015625024 2.007812480 2.003906304 2.001953280 2.000976896 2.000487424, , , , , ,2.000245760 2.000122880 2.000065536 2.000032768 2.000000000 2.000000000, , , , , ,2.000000000 2.000000000 2.000000000, , ]

    Although you will probably have little use for this we will do a simple animation. We will display a graph of the function ( ) ( )nxxf sin= as n takes on integer values from 1 to 10. The plot command is what will create each image in the sequence, it would look something like the following,

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    12

    plot(sin(n*x),x=-2*Pi..2*Pi)

    To create a sequence of these plots for different values of n, we simply place the plot command inside the seq command.

    seq(plot(sin(n*x),x=-2*Pi..2*Pi),n=1..10) Finally, to make it an animation we use the display command on the seq command with the display option of insequence set to true.

    display(seq(plot(sin(n*x),x=-2*Pi..2*Pi),n=1..10), insequence=true)

    The display command is in the plots package which can be used once we load it in. All in all the Maple commands would be, > with(plots): Warning, the name changecoords has been redefined

    > display(seq(plot(sin(n*x),x=-2*Pi..2*Pi),n=1..10), insequence=true);

    When you click on the image you should see the animation toolbar at the top of the window.

    The evalf Command The evalf command will find an approximation to whatever it is given. For example, > evalf(1/3);

    0.3333333333

    > evalf(Pi);

    3.141592654

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    13

    There is an optional value you can include to specify the number of decimal places the approximation will use. This value either goes in square brackets after the evalf name or as a parameter after the expression to be evaluated. > evalf[100](Pi);

    3.14159265358979323846264338327950288419716939937510582097494459230781\6406286208998628034825342117068

    > evalf(Pi,20); 3.1415926535897932385

    Another way to force Maple to give you an approximate answer, or at least a decimal answer is to at some point place a decimal number onto the expression. For example, > f(4.7);

    22.09

    > f(47/100); 2209

    10000

    The eval Command The eval command has many different uses. It s mainly used to evaluate an expression or function at a particular value. For example, > f:=x->x^2;

    := f x x2

    > f(x); x2

    > eval(f(x),x=3); 9

    > eval(x^2,x=3); 9

    The main difference between the eval command and the subs command is that the subs command will simply do the substitution, no mater if it makes sense or not. The eval command on the other hand will do the substitution and then the evaluation of the result. For example, > eval(cos(x)/sin(x),x=0); Error, numeric exception: division by zero

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    14

    > subs(x=0,cos(x)/sin(x)); ( )cos 0( )sin 0

    > eval(%); Error, numeric exception: division by zero

    One other use for the command is to investigate the levels of substitution in an expression that is a composition of several expressions. For example, say we have the following expressions. > a:=2*x-1;

    := a - 2 x 1

    > x:=3*y^2+2; := x + 3 y2 2

    > y:=z^3+z^2+z+1; := y + + + z3 z2 z 1

    > a;

    + 6 ( ) + + + z3 z2 z 12

    3

    The above command did all of the substitutions automatically and then output the result. We will get the same output using the eval command. > eval(a);

    + 6 ( ) + + + z3 z2 z 12

    3

    If we include an evaluation level as the second parameter in the eval command it will do only that many evaluations. For example, > eval(a,1);

    - 2 x 1

    > eval(a,2); + 6 y2 3

    > eval(a,3);

    + 6 ( ) + + + z3 z2 z 12

    3

    > eval(a,4);

    + 6 ( ) + + + z3 z2 z 12

    3

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    15

    The subs Command The subs command is for substituting expressions into expressions. That is, it will take all occurrences of an expression and replace it with another expression. The syntax for the command is

    subs(eqn,expr); where eqn is an equation where the left hand side is the expression to be substituted for and the right hand side is the expression to substituted in. The expr is the expression that the substitution is being done on. For example, > subs(x=2,3*x^2+2*x-1);

    15

    > subs(x=x-h,3*x^2+2*x-1); + - - 3 ( ) - x h 2 2 x 2 h 1

    > subs(cos(x)=y,cos(x)*(sin(x)+cos(x))); y ( ) + ( )sin x y

    Note that the subs command does not care if the substitution is legitimate or not. Sometimes the expression is simplified, as above, and sometimes it is not. For example, > subs(x=0,cos(x)/sin(x));

    ( )cos 0( )sin 0

    > eval(%); Error, numeric exception: division by zero

    Also, there are cases where the substitution does not go through the way we would want it to. This usually happens when there is a simplification step done, usually without our knowledge, before the substitution is done. In this case there is another substitution command called algsubs that is a bit more powerful. > subs(x+1=x-a,3*(x+1)^2+2*(x+1)-1);

    + + 3 ( ) - x a 2 2 x 1

    > algsubs(x+1=x-a,3*(x+1)^2+2*(x+1)-1); - + - 3 ( ) - x a 2 1 2 x 2 a

    The algsubs command will even go as far as to find the expression by factoring or doing some other manipulation. For example, > expand((x+1)^4);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    16

    + + + + x4 4 x3 6 x2 4 x 1

    > algsubs(x+1=y,x^4+4*x^3+6*x^2+4*x+1); y4

    > expand((x+1)^4+2*x+1); + + + + x4 4 x3 6 x2 6 x 2

    > algsubs(x+1=y,x^4+4*x^3+6*x^2+6*x+2); - + 2 y 1 y4

    Mathematical Functions The following is a list of some of the more useful mathematical functions and their Maple syntax.

    Trigonometric and Hyperbolic Functions Function Maple Syntax Notes

    ( )xsin sin(x) The sine function. ( )xcos cos(x) The cosine function. ( )xtan tan(x) The tangent function. ( )xcot cot(x) The cotangent function. ( )xsec sec(x) The secant function. ( )xcsc csc(x) The cosecant function. ( )xsinh sinh(x) The hyperbolic sine function. ( )xcosh cosh(x) The hyperbolic cosine function. ( )xtanh tanh(x) The hyperbolic tangent function. ( )xcoth coth(x) The hyperbolic cotangent function. ( )xsech sech(x) The hyperbolic secant function. ( )xcsch csch(x) The hyperbolic cosecant function. ( )x1sin - arcsin(x) The inverse sine function. ( )x1cos- arccos(x) The inverse cosine function. ( )x1tan - arctan(x) The inverse tangent function. ( )x1cot- arccot(x) The inverse cotangent function. ( )x1sec- arcsec(x) The inverse secant function. ( )x1csc- arccsc(x) The inverse cosecant function. ( )x1sinh - arcsinh(x) The inverse hyperbolic sine function. ( )x1cosh - arccosh(x) The inverse hyperbolic cosine function. ( )x1tanh - arctanh(x) The inverse hyperbolic tangent function.

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    17

    ( )x1coth- arccoth(x) The inverse hyperbolic cotangent function. ( )x1sech - arcsech(x) The inverse hyperbolic secant function. ( )x1csch - arccsch(x) The inverse hyperbolic cosecant function.

    Exponential and Logarithmic Functions Function Maple Syntax Notes xe exp(x) The exponential function. ( )xln ln(x) The natural logarithm function.

    ( )xlog log10(x) The common logarithm function. ( )xblog log[b](x) The general logarithm function, b > 0.

    Root Functions Function Maple Syntax Notes

    x sqrt(x) The square root function. n x surd(x,n) The nth root function.

    Other Functions Function Maple Syntax Notes x abs(x) The absolute value function.

    The solve Command The solve command is for finding exact solutions to equations or systems of equations. The syntax is simple

    solve(expr,vars) where expr represents the equation or system of equations and vars is a variable or list of variables. Note that the vars argument may be omitted; in this case the variables will be automatically taken to be all of the variables present in the equation or system of equations. Also, when inputting a system of equations or a list of more than one variable you should place them in a list. We will begin with an easy example. To solve the equation 265 24 =+- xxx we could use either > solve(x^4-5*x^2+6*x=2);

    , , ,1 1 - + 1 3 - - 1 3

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    18

    or > solve(x^4-5*x^2+6*x=2,x);

    , , ,1 1 - + 1 3 - - 1 3

    In the first solve command we let Maple determine that x was the variable. In the second solve command we explicitly told Maple that our variable was x. To solve the system of linear equations

    985

    732

    =+=+

    yx

    yx

    we could use > solve({2*x+3*y=7,5*x+8*y=9});

    { }, = y -17 = x 29

    or > solve({2*x+3*y=7,5*x+8*y=9},{x,y});

    { }, = y -17 = x 29

    Note that the list of variables that are input in the solve command will make a difference in the outputs. For example consider the following solve commands. > solve(2*x+3*y+z=7);

    { }, , = z - - + 2 x 3 y 7 = x x = y y

    > solve(2*x+3*y+z=7,z); - - + 2 x 3 y 7

    > solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},{x,y}); { }, = y - - + 17 11 z w = x + - 29 16 z w

    > solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},{x,y,z}); { }, , = y - - + 17 11 z w = x + - 29 16 z w = z z

    > solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},{x,y,z,w}); { }, , , = y y = z z = x - + 12 y 5 z = w + + 17 y 11 z

    > solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9}); { }, , , = y y = z z = x - + 12 y 5 z = w + + 17 y 11 z

    > solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},x);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    19

    Since the solve command finds exact solutions the output can at times be very long. For example. > solve(x^3-7*x^2+2*x+3=0,x);

    + + ( ) + 1916 12 I 9843

    ( )/1 3

    686

    3 ( ) + 1916 12 I 9843( )/1 3

    73

    ( ) + 1916 12 I 9843( )/1 3

    12-,

    43

    3 ( ) + 1916 12 I 9843( )/1 3

    73

    - +

    12

    I 3

    -

    ( ) + 1916 12 I 9843( )/1 3

    686

    3 ( ) + 1916 12 I 9843( )/1 3

    + ,

    ( ) + 1916 12 I 9843( )/1 3

    1243

    3 ( ) + 1916 12 I 9843( )/1 3

    73

    - - +

    12

    I 3

    -

    ( ) + 1916 12 I 9843( )/1 3

    686

    3 ( ) + 1916 12 I 9843( )/1 3

    -

    To obtain a numeric approximation to solutions of this form simply apply the evalf command to the output. > evalf(%);

    - 6.630098729 0.1 10-9 I - -0.5126801310 0.1732050808 10-8 I, ,

    + 0.8825814030 0.1732050808 10-8 I

    As will frequently happen when you evalf something like this you will get some round-off error. Note that all of the imaginary parts of the above solution are extremely small. This is an indication that the solutions are in fact real. Also since the solve command gives exact solutions there may be times when it can not give you a nice closed form. When Maple can give you an exact solution it will usually give a RootOf statement. Consider the following output. > solve(x^4-5*x^2+6*x=3,x);

    ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 1 ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 2, ,

    ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 3 ,

    ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 4

    As you can see, Maple knows that the equation has four solutions but it cant find any of them exactly. This is why it has essentially given you the question back in the solution. As above, to obtain an approximate solution to the equation, apply the evalf command to the above output.

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    20

    > evalf(%);

    1.538751996 + 0.6068401503 0.5831600070 I -2.752432296, , , - 0.6068401503 0.5831600070 I

    The fsolve Command The fsolve command is for finding numeric approximations to the solutions of an equation or system of equations. If the equation to be solved is a polynomial of a single variable the fsolve command will attempt to find all of the real solutions to the equation. If the equation is not a polynomial or if there is a system of equations to be solved the fsolve command will attempt to find a single solution. Note that even for polynomials of a single variable the fsolve command may not find all of the solutions. It is good practice to examine any equation or system of equations to determine approximate values for the solutions and then use the interval option in the fsolve command. The syntactical style of the fsolve command is the same as the solve command.

    fsolve(expr,vars) where expr represents the equation or system of equations and vars is a variable or list of variables. Note that the vars argument may be omitted, in this case the variables will be automatically taken to be all of the variables present in the equation or system of equations. Also, when inputting a system of equations or a list of more than one variable you should place them in a list. We will start with a couple polynomials. Note that the following fsolve command returns two real solutions for the solution. > fsolve(x^4-5*x^2+6*x=3,x);

    ,-2.752432296 1.538751996

    Using the solve command and the evalf command we see that the other two solutions are in fact complex (non-real). Hence the fsolve command found all of the real solutions. > solve(x^4-5*x^2+6*x=3,x);

    ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 1 ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 2, ,

    ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 3 ,

    ( )RootOf , - + - _Z4 5 _Z2 6 _Z 3 = index 4

    > evalf(%); 1.538751996 + 0.6068401503 0.5831600070 I -2.752432296, , ,

    - 0.6068401503 0.5831600070 I

    If we omit the variable, Maple assumes that it is x and solves the equation.

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    21

    > fsolve(x^3-7*x^2+2*x+3=0); , ,-0.5126801315 0.8825814030 6.630098729

    For equations that are not polynomials we expect a single solution as output from the fsolve command, as below. > fsolve(sin(x)=x-2);

    2.554195953

    > fsolve(sin(x)=x-2,x); 2.554195953

    If we plot the curves we see that there is only one real solution to the equation and hence no need to look for any more. > with(plots): Warning, the name changecoords has been redefined

    > implicitplot({y=sin(x),y=x-2},x=-10..10,y=-10..10, grid=[50,50]);

    On the other hand, say we wanted to solve the equation ( ) 0sin =x . This clearly has an infinite number of solutions and although we know what they are lets see how the fsolve command deals with an equation like this. Note that the simple application of the fsolve command returns 0 as a solution. > fsolve(sin(x)=0,x);

    0.

    If we were interested in finding a solution between 3 and 5 we would execute, > fsolve(sin(x)=0,x=3..5);

    3.141592654

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    22

    Even if there is more than one solution in a given interval the fsolve command will return only one. For example, > fsolve(sin(x)=0,x=20..30);

    25.13274123

    > fsolve(sin(x)=0,x=27..30); 28.27433388

    Lets look at a system of nonlinear equations. The following two commands are identical, at least to Maple, and they have the same output. > fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1});

    { }, = x 0.6361393915 = y 0.3912093747

    > fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1},{x,y}); { }, = x 0.6361393915 = y 0.3912093747

    Note that we get an error if we try to solve for only one of the variables. The fsolve command must find a numeric solution to all of the variables in the equations. > fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1},x); Error, (in fsolve) y is in the equation, and is not solved for

    If we graph the system of equations we see that there is another possible solution. > implicitplot({4*x^2+sin(y)=2,y/2+cos(x)=1},x=-5..5,y=-5..5,grid=[50,50]);

    We can use the fsolve command to approximate this solution by restricting both x and y to a rectangle that contains the other solution. For example, > fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1},{x=-5..0,y=-2..2});

    { }, = x -0.6361393915 = y 0.3912093747

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    23

    There is one more thing to aware of when using the fsolve command. As you know from linear algebra, if you have n variables and you want to find numeric solutions for all of them then you will need at least n equations. The same is true for nonlinear equations. Maple knows this and hence it does not even try to fsolve a system if there are fewer equations than there are variables. > fsolve({4*x^2*z+sin(y)=2,y+z/2+cos(x)=1}); Error, (in fsolve) number of equations, 2, does not match number of variables, 3

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    24

    Functions

    Defining a Function of a Single Variable To define a function of a single variable, start the command with the function name followed by := followed by the independent variable followed by the arrow -> followed by the mathematical expression for the function. For example, to define the function ( ) 532 2 -+= xxxf we use the command, > f:=x->2*x^2+3*x-5;

    := f x + - 2 x2 3 x 5

    Now you can use standard mathematical function notation to evaluate the function. For example, > f(0);

    -5

    > f(2); 9

    > (f(x+h)-f(x))/h; + - 2 ( ) + x h 2 3 h 2 x2

    h

    Using the map Command The map command is a quick way to evaluate a function at a number of values. Before using the map command you should define the function you wish to use and a list of values you want to use it on. Make sure that you use a list here and not a set. > f:=x->x^2;

    := f x x2

    > lst:=[-2,-1,0,2,5,10,104.8]; := lst [ ], , , , , ,-2 -1 0 2 5 10 104.8

    Now type in the map command using the function name and the list name. Note that you are to use only the function name. > map(f,lst);

    [ ], , , , , ,4 1 0 4 25 100 10983.04

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    25

    In the same manner we can map an already existing function. > map(sin,lst);

    [ ], , , , , ,- ( )sin 2 - ( )sin 1 0 ( )sin 2 ( )sin 5 ( )sin 10 -0.9033180209

    > evalf(map(sin,lst)); -0.9092974268 -0.8414709848 0. 0.9092974268 -0.9589242747 -0.5440211109, , , , , ,[

    -0.9033180209]

    Note what happens when we include the (x) in the expression. > map(f(x),lst);

    [ ], , , , , ,( )x -2 2 ( )x -1 2 ( )x 0 2 ( )x 2 2 ( )x 5 2 ( )x 10 2 ( )x 104.8 2

    Defining Piecewise Functions Piecewise defined functions can be created with the piecewise command. In the piecewise command you input the piecewise function in pairs. The first component is the range in which to apply the piece and the second component is the function to apply to that piece. You may put in as many pairs as you would like and the last entry need not be a pair but the function to use otherwise. If there is no default (otherwise) function Maple will assume that it is 0. Note that the output of the piecewise command is in a pretty-print mode unless you use it in a function definition. We would suggest that you try the command without a function definition to check your syntax before placing the command in a function definition. For example, > piecewise( x=0, 1, sin(x)/x );

    1 = x 0( )sin xx

    otherwise

    > piecewise( x=0, 1);

    {1 = x 00 otherwise

    > piecewise( x>0, 1,-1);

    {1 < 0 x-1 otherwise

    > piecewise( x

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    26

    > plot(piecewise( x

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    27

    Notice the vertical lines at 2 and 1 despite the fact that we used discont=true. This was due to the use of and in the defining of one of the ranges. If we rearrange the piecewise command a little we do get a better image of the function. > g:=x->piecewise(x2*x^2*y+3*x*y^3-5*x+2*y-1;

    := f ( ),x y + - + - 2 x2 y 3 x y3 5 x 2 y 1

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    28

    Now you can use standard mathematical function notation to evaluate the function. For example, > f(0,0);

    -1

    > f(2,7); 2117

    Similarly, to define the function ( ) ( ) ( ) 2lnsin,,, wzyxwzyxg +-+= we use, > g:=(x,y,z,w)->sin(x)+y-ln(z)+w^2;

    := g ( ), , ,x y z w + - + ( )sin x y ( )ln z w2

    > g(1,2,3,4); + - ( )sin 1 18 ( )ln 3

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    29

    Limits, Differentiation, Integration & Sums

    Evaluating Limits of Function of a Single Variable There are two main commands for limits, limit and Limit. As with most Maple commands that have both a capitalized and lowercase version the capitalized version will display the operation in a pretty-print manner and the lowercase version will perform the operations. If you do use the capitalized form of the command you can then evaluate the expression using the value command. The general syntax for the limit function is

    limit(expr, pos, dir); where expr represents the expression or function we are taking the limit of, pos represents the limit point, and dir is an optional argument for the direction of the limit, that is, either left or right. For example, > limit(x^2-1,x=2);

    3

    > Limit(x^2-1,x=2); lim x 2

    - x2 1

    > value(%); 3

    > limit((x^2-1)/(x-1),x=1); 2

    > limit(abs(x)/x,x=0); undefined

    > limit(abs(x)/x,x=0,left); -1

    > limit(abs(x)/x,x=0,right); 1

    We can also take limits at infinity by placing infinity or infinity for the position. > limit(arctan(t),t=infinity);

    p2

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    30

    > limit(arctan(t),t=-infinity);

    -p2

    Evaluating Limits of Multivariable Functions Limits of functions of two or more variables are substantially different from the limits of functions of a single variable primarily because you are no longer coming into the limit point from just two directions but are coming into the limit point from an infinite number of directions. Due to this fact, Maple has a difficult time finding the limits of functions of more than one variable. We can use Maple to get an idea if the limit actually exists or if it does not. If we feel that the limit does not exist we may be able to use Maple to find two different paths into the limit point that do not agree and hence prove that the limit does not exist. In our first example we will work with a relatively nice function. To find the limit of a function of two variables we simply replace the position by a list of positions. > f:=(x,y)->x^2-y^2;

    := f ( ),x y - x2 y2

    > limit(f(x,y),{x=2,y=3}); -5

    > limit(f(x,y),{x=5,y=-2}); 21

    The same holds true for functions of three or more variables. > g:=(x,y,z,w)->x^2-y^2/z+2*w;

    := g ( ), , ,x y z w - + x2y2

    z2 w

    > limit(g(x,y,z,w),{x=5,y=-2,z=3,w=sqrt(2)});

    + 713

    2 2

    Now for functions that are not as nice Maple could have a problem with these. In some cases Maple will notice that the limit is path dependent and hence does not exist. > f:=(x,y)->abs(x^2-y^2)/(x^2-y^2);

    := f ( ),x y - x2 y2

    - x2 y2

    > limit(f(x,y),{x=0,y=0});

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    31

    undefined

    > plot3d(f(x,y),x=-2..2,y=-2..2,axes=boxed);

    In other cases Maple may not recognize the path dependence and simply return the question. > f:=(x,y)->(x+y)^2/(x^2+y^2);

    := f ( ),x y( ) + x y 2

    + y2 x2

    > limit(f(x,y),{x=0,y=0});

    limit ,

    ( ) + x y 2

    + y2 x2{ }, = y 0 = x 0

    > plot3d(f(x,y),x=-2..2,y=-2..2,axes=boxed);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    32

    Derivatives of Functions of a Single Variable There are four derivative commands: D, Diff, diff and implicitdiff. The implicitdiff command is for finding derivatives of implicitly defined expressions, that is, for doing implicit differentiation. The other three are for derivatives of explicitly defined functions but there are major differences between the D command and the two diff commands. We will start with Diff and diff since these are the ones that will be used most often. Diff and diff are another pair of commands that will either produce a pretty-print version, Diff, or evaluate the derivative, diff. The syntax for either of these commands is

    diff(expr,var); where expr is the function or expression to be derived and var is the variable that we are differentiating with respect to. For example, > f:=x->x^2-3*x+2;

    := f x - + x2 3 x 2

    > diff(f(x),x); - 2 x 3

    > Diff(f(x),x);

    ddx

    ( ) - + x2 3 x 2

    > value(%); - 2 x 3

    We can take higher order derivatives simply by adding more variables to the list of arguments. For example, > diff(f(x),x,x);

    2

    > diff(f(x),x,x,x); 0

    > Diff(f(x),x,x);

    d

    d2

    x2( ) - + x2 3 x 2

    > Diff(f(x),x,x,x);

    d

    d3

    x3( ) - + x2 3 x 2

    > value(%);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    33

    0

    We can also use the $ repeater to do higher order derivatives. The $ will repeat an expression a given number of times. For example, > x$2;

    ,x x

    > x+7$2; , + x 7 + x 7

    > george$7; , , , , , ,george george george george george george george

    Using this in conjunction with the diff command allows us to short-cut some of the notation for higher order derivatives. For example, > diff(f(x),x$2);

    2

    > diff(sin(x),x$1023); - ( )cos x

    One minor difficulty with the Diff and diff commands is that they return the derivative as an expression and not as a function. Frequently we wish to have the derivative of a function defined as a function. If we use the Diff or diff command we must use the unapply command to turn the expression into a function. The syntax of the unapply command is

    unapply(expr,var) where expr is the expression to be converted to a function and var is the independent variable. For example, > f:=x->x^2-3*x+2;

    := f x - + x2 3 x 2

    > diff(f(x),x); - 2 x 3

    > df:=unapply(%,x); := df x - 2 x 3

    > df(x); - 2 x 3

    > df(2);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    34

    1

    The D command will also find the derivative of a function but its inputs and outputs are quite different than those of Diff and diff. The D command takes as input a function name only, just like the map command. It also outputs a function definition and not an expression. For example, > f:=x->x^2-3*x+2;

    := f x - + x2 3 x 2

    > D(f); x - 2 x 3

    Notice that the output suggests that what D is returning is a function that maps x to

    32 -x . To create a function that represents the derivative of f we simply need to assign a name to the output of the D command, the unapply command is not necessary. For example, > df:=D(f);

    := df x - 2 x 3

    > df(2); 1

    In fact we can also use the D command output as a function itself simply by appending an (x) or evaluate it at a particular value. > D(f)(x);

    - 2 x 3

    > D(f)(2); 1

    Higher order derivatives can be accomplished with the D command if we append the @@n operator, where n denotes the order of differentiation. For example the second and third derivatives of f can be found using, > (D@@2)(f);

    2

    > (D@@3)(f); 0

    respectively. The implicitdiff command will find derivatives of implicitly defined relations. The syntax of the implicitdiff command is as follows,

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    35

    implicitdiff(expr,var1,var2)

    where expr is the implicitly defined expression, var1 and var2 represent the derivative

    2var1var

    dd

    . For example, to find dxdy

    we use the command,

    > implicitdiff(x^2-y^2+x*y=sin(x*y),y,x);

    + - 2 x y ( )cos x y y - + 2 y x ( )cos x y x

    and to find dydx

    we use the command,

    > implicitdiff(x^2-y^2+x*y=sin(x*y),x,y);

    - - + 2 y x ( )cos x y x

    - - + 2 x y ( )cos x y y

    Similarly, we can give the implicit expression a name and use it in the implicitdiff command. Note that the following definition is an assignment of an expression to t and not a function definition. > t:=x*y-2*y=x^3;

    := t = - x y 2 y x3

    > implicitdiff(t,y,x); - + y 3 x2

    - x 2

    Partial Derivatives of Multivariable Functions To find partial derivatives in Maple is almost the same as finding derivatives. The Diff, diff and implicitdiff commands have exactly the same syntax and the D command needs just a little more information. We will start with the Diff and diff commands. In the following examples we define a function of two variables and find its first partials in a number of different ways. > f:=(x,y)->(y-x)*sin(x+y);

    := f ( ),x y ( ) - y x ( )sin + x y

    > diff(f(x,y),x); - + ( )sin + x y ( ) - y x ( )cos + x y

    > diff(f(x,y),y);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    36

    + ( )sin + x y ( ) - y x ( )cos + x y

    > Diff(f(x,y),x);

    x

    ( )( ) - y x ( )sin + x y

    > value(%); - + ( )sin + x y ( ) - y x ( )cos + x y

    > Diff(f(x,y),y);

    y

    ( )( ) - y x ( )sin + x y

    > value(%); + ( )sin + x y ( ) - y x ( )cos + x y

    Notice in the Diff command the notation has changed from the derivative to the partial derivative. Maple automatically recognizes that the function is multivariate and hence the derivatives will be partial derivatives. For higher order derivatives the order of partial derivatives is read from left to right. For example, > Diff(f(x,y),x,y);

    2

    y x( )( ) - y x ( )sin + x y

    > value(%); -( ) - y x ( )sin + x y

    > Diff(f(x,y),y,x);

    2

    x y( )( ) - y x ( )sin + x y

    > value(%); -( ) - y x ( )sin + x y

    > diff(f(x,y),y,x); -( ) - y x ( )sin + x y

    As with higher order derivatives of functions of a single variable we can use the $ notation to condense the command. > diff(f(x,y),x$2,y$3,x$4);

    - + 3 ( )sin + x y ( ) - y x ( )cos + x y

    > Diff(f(x,y),x$2,y$3,x$4);

    9

    x4 y3 x2( )( ) - y x ( )sin + x y

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    37

    > diff(f(x,y),y$3,x$6); - + 3 ( )sin + x y ( ) - y x ( )cos + x y

    The D command is a bit different for multivariate functions. As with single variable functions it expects a function name only but if you look closely at the D command we used for single variable functions there was no place where we told Maple what to take the derivative with respect to. For single variable functions Maple noticed that there was only one variable and assumed that that variable was the one you wanted. For multivariate functions Maple can no longer make that assumption. To tell Maple which variable to differentiate with respect to we place [i] between the D and the (f). The i in the brackets is a number that represents the variable that is being differentiated with respect to. The number corresponds to the position of the variable in the original definition of the function. For example, to take the partial derivative of the function > f:=(x,y)->(y-x)*sin(x+y);

    := f ( ),x y ( ) - y x ( )sin + x y

    with respect to x we use, > D[1](f);

    ( ),x y - + ( )sin + x y ( ) - y x ( )cos + x y

    since x was the first variable in the list of independent variables when the function f was defined. Likewise to take the partial derivative of f with respect to y we use, > D[2](f);

    ( ),x y + ( )sin + x y ( ) - y x ( )cos + x y

    since y was the second variable in the list of independent variables when the function f was defined. Note that if we reverse the order of the variables in the definition, 1 will correspond to y and 2 will correspond to x. > f:=(y,x)->(y-x)*sin(x+y);

    := f ( ),y x ( ) - y x ( )sin + y x

    > D[1](f); ( ),y x + ( )sin + y x ( ) - y x ( )cos + y x

    > D[2](f); ( ),y x - + ( )sin + y x ( ) - y x ( )cos + y x

    To do higher order derivatives we can replace [i] with a list of numbers. For example, the second partial of f with respect to x would be found by

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    38

    > f:=(x,y)->(y-x)*sin(x+y); := f ( ),x y ( ) - y x ( )sin + x y

    > D[1,1](f); ( ),x y - - 2 ( )cos + x y ( ) - y x ( )sin + x y

    The second partial with respect to y can be found by, > D[2,2](f);

    ( ),x y - 2 ( )cos + x y ( ) - y x ( )sin + x y

    The mixed partials by either of the following, > D[1,2](f);

    ( ),x y -( ) - y x ( )sin + x y

    > D[2,1](f); ( ),x y -( ) - y x ( )sin + x y

    One thing to note is that the order of differentiation is read from right to left when using the D command. That is, in our example, > D[1,2](f);

    ( ),x y -( ) - y x ( )sin + x y

    Maple took the partial with respect to y first and then it took the partial derivative of that with respect to x. As with the Diff and diff commands we can use the $ option to short-cut the notation, For example, > D[1$2](f);

    ( ),x y - - 2 ( )cos + x y ( ) - y x ( )sin + x y

    > D[1$4,2$3,1$7](f); ( ),x y - - 8 ( )cos + x y ( ) - y x ( )sin + x y

    The implicitdiff command for implicit differentiation is exactly the same for expressions with more than two variables. For example, > t:=x*y-2*z^2*y=x^3;

    := t = - x y 2 z2 y x3

    > implicitdiff(t,y,x); - + y 3 x2

    - x 2 z2

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    39

    > implicitdiff(t,y,z); 4 z y

    - x 2 z2

    > implicitdiff(t,z,y); - x 2 z2

    4 z y

    Integration of Single Variable Functions Finding definite and indefinite integrals with Maple is a snap. Although there are several special types of integral commands in Maple you can almost always get by with just two, Int and int. As with all capitalized and lowercase pairs of commands the capitalized one returns a pretty-print version and the lowercase one does the operation. Also, as with the other capitalized commands in Maple, the value command will force Maple to do the operation. To find an indefinite integral we use the syntax,

    int(expr,var) where the expr is the expression or function to be integrated and the var is the variable we are integrating with respect to. For example, > f:=x->x^2-3*x+2;

    := f x - + x2 3 x 2

    > int(f(x),x);

    - + 13

    x332

    x2 2 x

    > Int(f(x),x);

    d - + x

    2 3 x 2 x

    > value(%);

    - + 13

    x332

    x2 2 x

    Definite integrals can be found just as easily, we simply replace the var in the above syntax with a variable range. The range is, of course, the interval you are integrating over. For example, > f(x);

    - + x2 3 x 2

    > int(f(x),x=1..3);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    40

    23

    > Int(f(x),x=1..3);

    d

    1

    3

    - + x2 3 x 2 x

    > value(%); 23

    Maple also has some special commands for doing numeric approximations to integrals. It has commands for Riemann sums, the trapezoidal rule and Simpsons rule. All of these commands are in Maples student package. For an explanation of these commands please see the section in this guide on the student package.

    Integration of Multivariable Functions Maples student package has some special functions for finding double and triple integrals but there is not much more typing involved by simply doing multiple ints or Ints. For example, > f:=(x,y)->(y-x)*sin(x+y);

    := f ( ),x y ( ) - y x ( )sin + x y

    > Int(Int(f(x,y),x),y);

    d

    d

    ( ) - y x ( )sin + x y x y

    > value(%); - + ( )sin + x y ( ) + x y 2 x ( )sin + x y

    > int(int(f(x,y),x),y); - + ( )sin + x y ( ) + x y 2 x ( )sin + x y

    > Int(Int(f(x,y),y),x);

    d

    d

    ( ) - y x ( )sin + x y y x

    > value(%); - ( )sin + x y ( ) + x y 2 ( )sin + x y y

    > int(int(f(x,y),y),x); - ( )sin + x y ( ) + x y 2 ( )sin + x y y

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    41

    Definite integrals can also be found using the same syntax, just replace the variables with variable ranges. For example, > Int(Int(f(x,y),x=-2..3),y=0..1);

    d

    0

    1

    d

    -2

    3

    ( ) - y x ( )sin + x y x y

    > value(%); - - + 2 ( )sin 4 3 ( )sin 1 3 ( )sin 3 2 ( )sin 2

    > int(int(f(x,y),x=-2..3),y=0..1); - - + 2 ( )sin 4 3 ( )sin 1 3 ( )sin 3 2 ( )sin 2

    Maple can also handle ranges that are dependent on other variables. > Int(Int(f(x,y),x=-2..3*y-2),y=0..1);

    d

    0

    1

    d

    -2

    - 3 y 2

    ( ) - y x ( )sin + x y x y

    > value(%);

    - + 3 ( )sin 132

    ( )sin 2

    > int(int(f(x,y),x=-2..3*y-2),y=0..1);

    - + 3 ( )sin 132

    ( )sin 2

    For triple integrals we simply add on another int. > f:=(x,y,z)->x*sin(z)+cos(y);

    := f ( ), ,x y z + x ( )sin z ( )cos y

    > Int(Int(Int(f(x,y,z),z=-2..3),y=0..1),x=0..5);

    d

    0

    5

    d

    0

    1

    d

    -2

    3

    + x ( )sin z ( )cos y z y x

    > value(%);

    - + + 252

    ( )cos 3252

    ( )cos 2 25 ( )sin 1

    > int(int(int(f(x,y,z),z=-2..3),y=0..1),x=0..5);

    - + + 252

    ( )cos 3252

    ( )cos 2 25 ( )sin 1

    > Int(Int(Int(f(x,y,z),z=2*x+3*y-4..3*x-y+7),y=-x+1..3*x+2),x=0..5);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    42

    d

    0

    5

    d

    - 1 x

    + 3 x 2

    d

    + - 2 x 3 y 4

    - + 3 x y 7

    + x ( )sin z ( )cos y z y x

    > value(%); 252

    ( )sin 5523

    ( )cos 17239

    ( )sin 175

    33( )cos 57

    1363

    ( )sin 57116

    ( )sin 26 + - - + -

    54

    ( )cos 26 9 ( )sin 4 32 ( )cos 41948

    ( )sin 653

    ( )cos 6 ( )cos 227801089

    ( )sin 2 + + - + - + +

    263

    ( )sin 1 7 ( )cos 1 + +

    > evalf(%); 11.70116137

    > int(int(int(f(x,y,z),z=2*x+3*y-4..3*x-y+7),y=-x+1..3*x+2),x=0..5); 252

    ( )sin 5523

    ( )cos 17239

    ( )sin 175

    33( )cos 57

    1363

    ( )sin 57116

    ( )sin 26 + - - + -

    54

    ( )cos 26 9 ( )sin 4 32 ( )cos 41948

    ( )sin 653

    ( )cos 6 ( )cos 227801089

    ( )sin 2 + + - + - + +

    263

    ( )sin 1 7 ( )cos 1 + +

    If you really want short-cut syntax for the double and triple integrals you can always create a new command yourself. For example, we create four commands below that find double and triple integrals, both have pretty-print versions and evaluation versions. > dint:=(f,xrng,yrng)->int(int(f,xrng),yrng);

    := dint ( ), ,f xrng yrng d

    d

    f xrng yrng

    > Dint:=(f,xrng,yrng)->Int(Int(f,xrng),yrng);

    := Dint ( ), ,f xrng yrng d

    d

    f xrng yrng

    > tint:=(f,xrng,yrng,zrng)->int(int(int(f,xrng),yrng),zrng);

    := tint ( ), , ,f xrng yrng zrng d

    d

    d

    f xrng yrng zrng

    > Tint:=(f,xrng,yrng,zrng)->Int(Int(Int(f,xrng),yrng),zrng);

    := Tint ( ), , ,f xrng yrng zrng d

    d

    d

    f xrng yrng zrng

    Examples of these commands are below. > f:=(x,y)->(y-x)*sin(x+y);

    := f ( ),x y ( ) - y x ( )sin + x y

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    43

    > Dint(f(x,y),x=-2..4,y=-3..8);

    d

    -3

    8

    d

    -2

    4

    ( ) - y x ( )sin + x y x y

    > value(%); - + - - 4 ( )sin 12 10 ( )sin 6 7 ( )sin 1 ( )sin 5

    > dint(f(x,y),x=-2..4,y=-3..8); - + - - 4 ( )sin 12 10 ( )sin 6 7 ( )sin 1 ( )sin 5

    > f:=(x,y,z)->x*sin(z)+cos(y); := f ( ), ,x y z + x ( )sin z ( )cos y

    > Tint(f(x,y,z),z=2*x+3*y-4..3*x-y+7,y=-x+1..3*x+2,x=0..5);

    d

    0

    5

    d

    - 1 x

    + 3 x 2

    d

    + - 2 x 3 y 4

    - + 3 x y 7

    + x ( )sin z ( )cos y z y x

    > value(%); 252

    ( )sin 5523

    ( )cos 17239

    ( )sin 175

    33( )cos 57

    1363

    ( )sin 57116

    ( )sin 26 + - - + -

    54

    ( )cos 26 9 ( )sin 4 32 ( )cos 41948

    ( )sin 653

    ( )cos 6 ( )cos 227801089

    ( )sin 2 + + - + - + +

    263

    ( )sin 1 7 ( )cos 1 + +

    > tint(f(x,y,z),z=2*x+3*y-4..3*x-y+7,y=-x+1..3*x+2,x=0..5); 252

    ( )sin 5523

    ( )cos 17239

    ( )sin 175

    33( )cos 57

    1363

    ( )sin 57116

    ( )sin 26 + - - + -

    54

    ( )cos 26 9 ( )sin 4 32 ( )cos 41948

    ( )sin 653

    ( )cos 6 ( )cos 227801089

    ( )sin 2 + + - + - + +

    263

    ( )sin 1 7 ( )cos 1 + +

    Finite and Infinite Sums Maple can find finite and infinite sums using the two commands, sum and Sum. As with all of the capitalized lowercase command pairs, the command Sum will set up the sum and display it in a pretty-print manner. You can get the value of the result by applying the value command. The lowercase sum command will evaluate the sum without the need to apply the value command. The syntax of the sum command is

    sum(expr,rng); where expr represents the ith term and rng is the range of the sum. Note that rng can be finite or infinite. For example,

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    44

    > Sum(i,i=1..5);

    = i 1

    5

    i

    > value(%); 15

    > Sum(i^3,i=1..50);

    = i 1

    50

    i3

    > value(%); 1625625

    > sum(i^3,i=1..50); 1625625

    > sum(1/i,i=1..50); 139432375772240549607593099044504245996706400

    > evalf(%); 4.499205338

    > sum(1/i,i=1..500); 663338429989119806546143302387421466015138348898782940686870090780227\

    937698636415400569017248053724834931036587121859174364111676672813\949472763785044905480298961334427450045382592284705223585961537823\

    8909694581687099 9765282975860379545848516602538973177301511766\

    838567872846558671279507656107161785910367975985510264702441680886\454516761775201775149778279241658755154640446941522074794053108833\85229609852607806002629415184926954240

    > evalf(%); 6.792823430

    > sum(1/i-1/(i+1),i=1..1000000); 10000001000001

    > evalf(%); 0.9999990000

    For infinite sums simply set the ending bound to infinity. For example, > sum(1/i-1/(i+1),i=1..infinity);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    45

    1

    > sum(1/i^2,i=1..infinity); p2

    6

    > sum(1/i^3,i=1..infinity); ( )z 3

    > sum(1/i^4,i=1..infinity); p4

    90

    Finite and infinite sums need not be entirely numeric. For example, > Sum(1/i!*x^i,i=0..infinity);

    = i 0

    xi

    !i

    > sum(1/i!*x^i,i=0..infinity); ee x

    > sum(1/i*x^i,i=1..infinity); - ( )ln - 1 x

    Note that in the last couple expressions Maple noticed the form of the sum and simplified the sum into a function. Similarly, we can define a function to be an infinite (or finite) sum. > f:=x->sum(1/i*x^i,i=1..infinity);

    := f x = i 1

    xi

    i

    > f(-3); undefined

    > f(-1); - ( )ln 2

    > f(1/2); ( )ln 2

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    46

    The taylor Command On the flip-side of the sum command, which can convert a sum to a function, there is the taylor command that can take a function and return the first n terms of its Taylor series. The general syntax of the taylor command is

    taylor(expr,val,n) where expr is the expression or function to be taylorized, val should be of the form x=a where a is the point of expansion and n is the degree of the Taylor polynomial to be returned. For example, > taylor(exp(x),x=0,5);

    + + + + + 1 x12

    x216

    x31

    24x4 ( )O x5

    > taylor(sin(x),x=0,20);

    x16

    x31

    120x5

    15040

    x71

    362880x9

    139916800

    x111

    6227020800x13 - + - + - + -

    11307674368000

    x151

    355687428096000x17

    1121645100408832000

    x19 ( )O x20 + - +

    Note that in the expansion Maple attaches a O(n) last term that represents the tail of the series. We can remove it by using the convert command. For example, > taylor(sin(x),x=0,5);

    - + x16

    x3 ( )O x5

    > convert(taylor(sin(x),x=0,5),polynom);

    - x16

    x3

    With the convert command we can create a new command, called ntaylor, that will return the nth degree Taylor polynomial of a function. > ntaylor:=(f,val,n)->convert(taylor(f,val,n),polynom);

    := ntaylor ( ), ,f val n ( )convert ,( )taylor , ,f val n polynom

    > ntaylor(sin(x),x=0,6);

    - + x16

    x31

    120x5

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    47

    This command comes in handy when exhibiting the convergence of the Taylor polynomial to the function, as we show below. > plot([sin(x),seq(ntaylor(sin(x),x=0,n),n=1..20)],x=-10..10,y=-5..5,numpoints=500);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    48

    Graphing Maple has many advantages for teaching Calculus but one of its strongest is the plethora of graphing commands and ease of creating animations. Although we will not discuss the creation of animations here we will cover many of the graphing commands that are applicable to Calculus I, II and III. After you create a Maple graph you can click on the image to bring up the image toolbar. This toolbar will allow you to change several of the image options simply by clicking a button. Another option you have is to right-click on the image. This will bring up a pop-up menu of options as well as facilities to save the image in a number of different file formats. As always, you can copy and paste Maple graphs into any application that supports drag and drop graphics.

    Two Dimensional Plots

    The plot Command: Plotting Functions The plot command is for plotting functions or parametrically defined equations. You can use a large number of options to alter the image to suit your needs as well as use a number of different coordinate systems. The syntax for the plot command is very simple,

    plot(expr,rng,options) where expr is the expression or function to plot, rng is the range of the independent variable and options represents a list of options. The expr and rng arguments are necessary but you do not need to have any. On the other hand, you may have as many options as you would like. We will not discuss all of the plot options here but we will hit some of the ones you will use most often. For further option listings please see the Maple documentation or help system. Lets look at a few examples. > f:=x->sin(x);

    := f sin

    > plot(f(x),x=-2*Pi..2*Pi);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    49

    To graph more than one function on the same graph we simply place the set of functions either in a list or a set. For example, > plot([f(x),g(x),h(x)],x=-2*Pi..2*Pi);

    > plot({f(x),g(x),h(x)},x=-2*Pi..2*Pi);

    As with all sets and lists, the list retains its order and a set might not. Hence, if you use a set here the colors of the different graphs may differ from the same command that uses a list. When Maple graphs a function it does it so that the graph fits the box. This, in many cases, will distort the image of the graph. To get a true picture of the function you can include the scaling=constrained option. This will graph the function in a 1-1 manner. You can get the same result by clicking the 1-1 button in the toolbar. > plot(f(x),x=-2*Pi..2*Pi,scaling=constrained);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    50

    Another way to alter the vertical scale is by inputting a vertical scale. For example, consider the difference between the following two graphs, > plot(1/(x-1),x=0..2);

    > plot(1/(x-1),x=0..2,y=-10..10);

    This last image brings up another option that is frequently used with rational functions. Note that in the above image the vertical asymptote is shown, to eliminate it we can add the discont=true option. > plot(1/(x-1),x=0..2,y=-10..10,discont=true);

    The color option sets the color of the function. Possible values or the color option are: aquamarine, black, blue, navy, coral, cyan, brown, gold, green, gray, grey, khaki,

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    51

    magenta, maroon, orange, pink, plum, red, sienna, tan, turquoise, violet, wheat, white, and yellow. For example, > plot(f(x),x=-2*Pi..2*Pi,color=black);

    When plotting more than one function you can use a list for the color option to control each color independently. > plot([f(x),g(x),h(x)],x=-2*Pi..2*Pi, color=[red,black,blue]);

    Another way to alter the lines appearance is with the linestyle option. The values for the linestyle option are SOLID, DOT, DASH, and DASHDOT. Note that as of Maple 8 these options must be typed in uppercase > plot(f(x),x=-2*Pi..2*Pi,color=black,linestyle=DASHDOT);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    52

    We can control the thickness of a line as well. Thicknesses can range from 1 to 15, a thickness of 16 results in a thickness of 1, 17 to 2 and so on. For example, > plot(f(x),x=-2*Pi..2*Pi,color=black,thickness=5);

    In Calculus II you use the definite integral to, among other things, find the area between a curve and the x-axis. To display this area you can add the filled=true option. For example, > plot(f(x),x=-2*Pi..2*Pi,filled=true);

    In some cases the number of points Maple uses to graph a function is insufficient. To compensate you can manually set the number of points used in a graph with the numpoints option. For example,

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    53

    > plot(sin(1/x),x=0..1);

    > plot(sin(1/x),x=0..1,numpoints=10000);

    Remember that the larger the number of points the longer it will take Maple to graph the function. Another option that is used from time to time is the view option. The view option will display only the portion of the graph you designate, no matter what domain you gave the plot command. For example, > plot(sin(x),x=-2*Pi..2*Pi,view=[0..5,0..1]);

    The last option we will discuss for the plot command is the coords option. This option allows you to change the coordinate system you are working with. The available values for this option are: bipolar, cardioid, cassinian, elliptic, hyperbolic, invcassinian, invelliptic, logarithmic, logcosh, maxwell, parabolic, polar, rose, and tangent. Most

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    54

    likely, the only one you will use in a Calculus sequence is polar. When you include coords=polar as an option the resulting graph will be graphed using the polar coordinate system and not the rectangular system. For example, > plot(sin(t),t=0..2*Pi,coords=polar);

    The plot Command: Plotting Parametrically Defined Equations To plot a parametrically defined equation we place the x equation, y equation and the parameter range inside square brackets. Note that the range is inside the brackets. For example, to plot the equations

    ( )( )

    ==

    ty

    tx

    cos

    sin

    for p20 t , we use, > plot([sin(t),cos(t),t=0..2*Pi]);

    We can use any of the plot options as well as specify and x and y range for graphing. For example,

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    55

    > plot([sin(t),cos(t),t=0..2*Pi],x=-2..2,y=-2..2, color=green,filled=true);

    The implicitplot Command The implicitplot command is for graphing implicitly defined relations. The syntax for the implicit plot command is similar to the plot command except that it requires ranges for both x and y. The implicitplot command is not loaded automatically by Maple, it resides in the plots package and hence needs to be loaded with the with command. For example, > with(plots): Warning, the name changecoords has been redefined

    Dont worry about the warning. > implicitplot(x^2-y^2=3,x=-5..5,y=-5..5);

    Most of the plot option also work with the implicitplot command, please see the plot command information in this guide or the Maple documentation for a more detailed explanation of the available options. > implicitplot(x^2-y^2=3,x=-5..5,y=-5..5,color=black, linestyle=DASHDOT);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    56

    One option that is not available is the numpoints option. When graphing an implicitly defined relation, Maple uses a grid of points and not a list of points. So if you want to increase the number of points used to graph the curve you need to add the grid option to the implicitplot command. For example, look at the following image. > implicitplot(x^2-y^2=0,x=-2..2,y=-2..2);

    Notice that there is a square in the center. This square is an error produced by the fact that the curve has a self-intersection at the origin. We can minimize the size of the square, and sometimes remove it, by increasing the grid divisions as in the next command. > implicitplot(x^2-y^2=0,x=-2..2,y=-2..2,grid=[100,100]);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    57

    As with the numpoints option the larger the grid divisions the longer it will take to produce an image.

    The contourplot Command The contourplot command is for producing contour plots of a surface. Its syntax is very similar to that of the implicitplot command, except that in place an implicitly defined relation we give it a surface. The contourplot command is in the plots package, so you will have to load the plots package into your worksheet. > with(plots): Warning, the name changecoords has been redefined

    > f:=(x,y)->sin(x*y);

    := f ( ),x y ( )sin y x

    > contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50]);

    In addition to the implicitplot options the contourplot allows you to have some control over the number and positions of the contours. For example, you can use the contours=list option to set the contour positions to the values in a list. > contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50], color=black,contours=[-1/2,1/4,1/2,3/4]);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    58

    You can also simply set the number of contours used by contours=n where n is the number of contours that Maple should plot. Maple will then choose the positions for you. > contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50], color=black,contours=5);

    The gradplot Command The gradplot command is for producing plots of the gradient field of a function of two variables. There is a corresponding command, gradplot3d, for functions of three variables. The syntax for the gradplot command is as follows.

    gradplot(expr,xrng,yrng) where expr is the expression or function of two variables, xrng is the range for the x direction and yrng is the range for the y direction. Of course, you may, in addition, have any options you wish. The gradplot command is in the plots package, so you will have to load the plots package into your worksheet. > with(plots): Warning, the name changecoords has been redefined

    > gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    59

    Along with the other plot options the gradplot has an arrows option whose values are LINE, THIN, SLIM and THICK. The default is THIN, LINE produces a plot without arrowheads, SLIM and THICK are shown below. > gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,arrows=SLIM);

    > gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,arrows=THICK);

    As is commonly done we can graph both the gradplot and contourplot together using the display command. > display(gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi), contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50]));

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    60

    Another, more common way, to paste the graphs together is to define a variable name to each graph and then display the two variables. Note that we use the : to suppress the output. The output from an assignment statement like the ones below is usually a very long list of coordinates and basic drawing structures, nothing you want to see. > a:=gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi): > b:=contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50]): > display(a,b);

    The fieldplot Command The fieldplot command is for producing plots of vector fields over R2. There is a corresponding command, fieldplot3d, for vector fields over R3. The syntax for the fieldplot command is similar to that of the gradplot command.

    fieldplot(expr,xrng,yrng) where expr is the vector-valued expression or function in R2, xrng is the range for the x direction and yrng is the range for the y direction. Of course, you may, in addition, have any options you wish. The fieldplot command is in the plots package, so you will have to load the plots package into your worksheet. > with(plots): Warning, the name changecoords has been redefined

    > fieldplot([x,-y],x=-2..2,y=-2..2);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    61

    > f := (x,y)-> y: g := (x,y)-> -x: fieldplot([f,g],-10..10,-10..10,arrows=SLIM);

    Infinity Plots There are no special commands for infinity plots, in fact you simply use the plot command. Infinity plots are a bit different so we gave them there own small section. Whenever you place infinity as a bound for one of the ranges in a plot Maple will automatically create an infinity plot where the endpoints of the axes are infinite. For example, > plot(sin(x), x=0..infinity);

    > plot([exp(x),ln(x),x^2,sqrt(x),sin(x),(7*x^2-2)/(x^2+5)], x=-infinity..infinity);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    62

    The logplot and loglogplot Commands The logplot command produces a semi-log plot of the function or set of functions. The loglogplot produces a log-log plot of the function or set of functions. The syntax for the logplot and loglogplot commands is as follows

    logplot(expr,xrng)

    loglogplot(expr,xrng) where expr is the function or set of functions and xrng is the range for the x direction. Of course, you may, in addition, have any options you wish. The logplot and loglogplot commands are in the plots package, so you will have to load the plots package into your worksheet. > with(plots): Warning, the name changecoords has been redefined

    > logplot(exp(x),x=-3..10);

    > loglogplot(x^7,x=1..10);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    63

    The arrow command The arrow command is quite useful when discussing vectors. The arrow command has a lot of different options for displaying vectors, we will look at just a few here. The arrow command is in the plots package, so you will have to load the plots package into your worksheet. > with(plots): Warning, the name changecoords has been redefined

    In its simplest form, to plot a vector simply input the vector. > arrow([1,2]);

    To alter the appearance of the vector use the shape option with either the arrow or harpoon value. For example, > arrow([1,2],shape=arrow);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    64

    > arrow([1,2],shape=harpoon);

    To plot a vector that begins at one point and ends at another, input both points, as vectors, and use the difference option, as below. > arrow([1,2],[3,4],shape=arrow,difference,view=[-2..4,-1..5]);

    If you input two vectors without using the difference option Maple will graph the second vector starting at the position of the first vector. For example, > arrow([1,2],[3,4],shape=arrow,view=[-2..4,-1..7]);

  • A Guide to Maple 8 & 9 Commands for Calculus I, II & III

    65

    If you place the two vectors in a single set then the vectors will be graphed together starting at the origin. > arrow({[1,2],[3,4]},shape=arrow,view=[-2..4,-1..5]);

    Finally, if we input two sets of