New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Claudine Friesen


Claudine Friesen
GPA 3.56


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Mathematics (M)

This 19 page Class Notes was uploaded by Claudine Friesen on Monday September 28, 2015. The Class Notes belongs to MATH103 at University of Pennsylvania taught by Staff in Fall. Since its upload, it has received 17 views. For similar materials see /class/215396/math103-university-of-pennsylvania in Mathematics (M) at University of Pennsylvania.




Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/28/15
int and Int The int command is used to compute both de nite and inde nite integrals of Maple expressions The syntax of int is Maple39s usual intwhat how syntax quotWhatquot in this case refers to quottake the integral of whatquot and quothowquot to quotwith respect to what variablequot and also quotover what intervalquot if the integral is a de nite one For example to compute 3 6 dx x 4 we would enter gt restart gt int3x 6xquot2 4x 3lnx 2 Notice the rst argument of int is the expression whose integral is being taken and the second tells with respect to what variable the integral is being done In this example of an inde nite integral notice that Maple does not provide a constant of integration You will occasionally have to take this into account and provide your own constant The second quothowquot argument of int becomes crucial in expressions such as gt intexpax x em a where there are constants parameters or other variables around Maple assumes that you mean to take the integral as the variable you specify changes and that all other letters in the expression represent constants To compute a de nite integral you providZe a quotrangequot for the variable just as in plot 2 statements For example to compute x e x dx 94 we enter gt intxquot2expx x0 2 2 2e 2 There are a few things that can go quotwrongquot when you use a computer algebra package to calculate integrals l The integral might be impossible to evaluate in closed form When Maple encounters such an integral or one it can t do for some other reason it simply returns the quotunevaluatedquot integral For example gt int1nsinsqrtxquot12 5xquot750x2 x lnsin x12 5 x7 50x 2 dx This indicates that Maple has quot given upquot on the integral but see the section below on numerical evaluation of integrals 2 The integral cannot be evaluated in closed form in terms of quotelementaryquot functions trig exponential powers roots logs but mathematicians have assigned a special name to it or a closely related integral because it comes up a lot in applications For example gt intsin2x xx7 S392x Here quotSiquot is the name of one of these quotspecial functions of mathematical physicsquot To learn about such a function if it comes up use Maple s help facility Typing gt si will bring up a window with somewhat helpful information about the quotSiquot function at least its definition You can be fairly but not completely certain that if Maple produces an answer in terms of one of these exotic functions then there is not an answer in terms of elementary functions 3 Doing the integral involves some hypotheses on the variables involved ranges not speci ed for indefinite integrals or there are complex as in complex numbers versions of the answers that may seem unfamiliar the telltale sign of this is an answer involving 95 capital quot1quot which Maple uses for the complex number Vl An example gt intxquot2sqrt1 sinx quot2 x 21x 21x 21 21e xx2e x I221xx22e e21x Of course this example is somewhat contrived since if we used the obvious trig identity rst then Maple would have no problem gt intxquot2cosx x x2 sinx 2 sinx 2 x cosx But this shows that it is sometimes wise to think a little before you press quotenterquot Numerical integration You can force Maple to apply a numerical approximation technique for de nite integration Maple uses techniques that are related to but more sophisticated than Simpson s rule and the trapezoidal rule as follows gt eva1fIntsqrt1xquot10 x0 1 1040899075 Notice that the Int command is capitalized in this statement this is to prevent Maple from attempting to evaluate the integral symbolically and then just quot eval f quoting the answer see below for other uses of capitalized Int Remarks Occasionally to make your worksheets easier to read you may wish to have Maple display an integral in standard mathematical notation without evaluating it For this there is a capitalized quotinertquot form of the int command gt Intexpx1 x x or for a de nite integral gt Int1n13xF1 4 96 4 J lnl3xdx 1 Sometimes you can use the two forms together to produce meaningful sentences gt Int1n13x x1 4int1n13x x1 4 8 13 J 1m13xya ma man 3 l A few other things can go wrong using the int command other than syntax errors for example the variable in the command the X above has already been given a value that you forgot about gt x3 gt intxquot2sin2xquot2 x Error in int wrong number or type of arguments or gt intxquot2sin2xquot2 x0 3 Error in int wrong number or type of arguments The other common mistake especially with indefinite integrals is to forget the quothowquot pa1t which is required gt intyquot2 Error in int wrong number or type of arguments You must type gt intYA2Y 97 98 Expressions vs Functions vs Programs in Maple One issue that often causes confusion is the distinction Maple makes between quotexpressionsquot and quotfunctionsquot Sometimes the same confusion exists in ordinary mathematics between quotvariablesquot and quotfunctionsquot The idea is pretty straightforward but can be hard to keep track of sometimes 2 For example suppose you want y to be x There are two senses 1n mathematlcs and in Maple in which this can be taken First you may simply want y to be a variable that represents the square of whatever x happens to be Then in Maple you would write gt restart gt y xquot 2 2 y x In mathematics you d write pretty much the same thing but without the colon This de nes y to be the expression xquot2 The other thing you might mean is that y should represent a function that transforms any number or variable into its square Then in Maple you would write gt y x gtxquot 2 2 yxax You read this as quoty maps x to x squaredquot In ordinary math you would probably write yxxA2 more or less In calculus classes we are often casual to the point of being careless about the distinction between variables and functions This is one reason the chain rule for derivatives can be so confusing Maple however forces us to be explicit about whether we are using expressions or functions Most of the time we can accomplish what we want to do with either of them although the way we have to do things can be somewhat different as illustrated below but occasionally we are forced to use one or the other We look at several most we hope of the operations you will need to apply to functions and expressions sometimes we will use commands that are described elsewhere in this manual without too much explanation you can nd more complete explanations in the sections dealing with these commands The operations we will look at are quotplugging a value or other expression in for xquot into y solving equations involving y applying calculus operations limit derivative and integral to y and plotting the graph of y EXPRESSIONS Even though it is not such an interesting expression we will go through all of the operations on the expression xquot2 So all of the examples below assume that the statement gt y xquot 2 y x has been executed rst 1 Plugging in To plug a number or other expression in for x and evaluate y the command subs short for substitute is used The syntax is explained fully in the section on the subs command Here is asimple example gt subsx8y 64 It is possible to make substitutions of one variable for another as well f2 You can even substitute expressions involving x for x such as when you calculate derivatives by the de nition ie the long way gt subsxfy gt subsxxhy x h2 The important thing to remember about subs is that it has NO EFFECT on y at all It just reports what the result would be if you make the substitution So even after all the statements above the value of y is still gtY7 2 Solving equations One helpful use of expressions is that they save typing You can use the name of an expression in its place anywhere you might need to type the expression Not that xquot 2 is so onerous to type but you can imagine more substantial uses To solve quadratic equations for instance xquot25 we can type y instead of xquot2 as follows Em3 40 gt solve y5 This works of course with fsolve too gt fsolve y5 2236067977 2236067977 Here is a more sophisticated example note that we have to tell Maple what variable we are solving for because there are more than one gt solve yaquot24a4 x a 2 a 2 3 Calculus operations The syntax for calculus operations is just as described in their respective sections For instance to calculuate the limit of xquot2 as x approaches 5 we would type gt 1imityx5 25 Or the derivative of xquot 2 gt diff y x 2 x Or the inde nite integral gt int Y I x 7 3 x Or a de nite one gt intyx 2 2 16 3 4 Plotting To plot the graph of y the standard syntax of the plot statement is used gt plotyx 4 4 thickness2 41 16 An important aspect which contrasts with using functions is that the variable appears in the speci cation ofthe domain ie the quot xquot in x 4 4 In general expressions are easier to de ne and use than functions as we shall now see FUNCTIONS Again we39ll stick with defining y to be xquot 2 But this time we re assuming that y has been defined as a function via the statement gt yxgtxquot2 2 yxx l Plugging in This is the one operation that is actually easier for functions Since the definition of y is now gt Y y invisible to the usual way of looking at variables because y is not a variable it is a function But you can look at the definition of y using the notation of standard mathematics gt Y x 2 x Since y is a function we can use other letters or expressions in place of X in yX gt Y t 42 t gt W5 25 gt yxh xh2 You get the idea 2 Solving equations To solve an equation involving a function you need to plug in a variable in order to convert it to an expression because equations have expressions on either side of the equals sign Note that y is afunction but yx is an expression gt solve y2x This gives no output because y is a function not an expression We should type instead 545 gt solveyx2x7 It is the same with fsolve gt fsolveyx17 x3 5 4123105626 See the f solve section of this manual for the rest of the syntax here 3 Calculus Maple actually has a special command for taking derivatives of functions but none for limits or integrals It is called D You don t need in fact you shouldn t use the y x notation with D just y gt DY x a 2 x Notice that the result of D is another function here the function that maps x to 2 x rather than an expression as is the case with diff For integrals and limits you must use the y x notation as with equations It is also possible to use diff with the y x notation Here are some examples First one that doesn39t work gt 1imityx3 See why we need the yx notation 43 gt 1imityx x3 gt diffltyltxgtxgt 2x Of course one advantage of functions is that we can also do gt diffyt t 2t if we need to Finally for integrals gt infYOU Ix 3 x gt intYq Iq14 21 4 Plotting There are two ways to do plotting of functions The rst is the usual way as for expressions and works the same as the calculus rules with y x gt plotyx x 3 3thickness2 No surprises here all of the usual plotting options and tricks are available for functions this way One new wrinkle is that a function can be plotted without using the y x notation but the 44 syntax is slightly different Since no variable is speci ed in the notation no variable can be speci ed for the domain otherwise an quotempty plotquot will result Here is the proper syntax gt ploty 3 3 thickness2 That s basically it as far as functions and expressions are concerned The idea of using functions opens up a major new part of the Maple system the fact that in addition to beinga quotcalculus calculatorquot it is also a programming language Yes you can write programs in Maple This will occasionally be useful because occasionally you will need to apply some procedure like taking the derivative and setting it equal to zero over and over and you will get tired of typing the same thing all the time You can create your own extensions to the Maple language in this way Our purpose here is not to teach Maple programming but here are a few basics and an example or two so you see how it39s done There are several examples of Maple programs in the demonstrations You can copy and paste them in your homework assignments if you find this useful you will occasionally A Maple program actually called a quotprocedurequot is created by a Maple statement containing the proc command A simple example is the following gt y procx xquot2 end y pr0cx xAZ end prov This statement is in fact equivalent to y x gtxquot2 In fact Maple translates y x gtxquot2 into the above statement It illustrates most of the basic parts of a Maple 45 program 1 y it is necessary to give your program a name You do this by assigning the procedure to a variable name 2 proc This tells Maple that you are writing a program 3 x You put the names of the input to the program in parentheses In this case the program takes one piece of input the number x 4 xquot 2 This is the statement that will be executed when the program is run There can be many statements in a procedure They are separated by semicolons as usual 5 end All programs must end with an end statement otherwise how is Maple to know you re done Once the program is de ned you can use it just as you would any Maple command gt Y 20 400 and so forth A more interesting program is the following one which looks for critical points it doesn39t always work though gt crit proc f local d ddifffx printsolved 0x is a critical point for f end crit pr0cf local 61 d di ff x prinisolved 0 x is a critical point for f end prov Notice that Maple parrots back the definition of the function This function needed two statements and has a quotlocalquot variable To get more than one line in your definition of a function you need to use the SHIFTENTER keys together between lines and just plain ENTER at the end The quot localquot variable means that quot dquot is declared to be a quotprivatequot variable for the purposes of the program so the use of 1 here will NOT interfere with any other definition of d that may be hanging around outside of the program Local variables must be 46 declared right at the beginning of the program and a semicolon must follow the list of local variables The other new thing here is the quot printquot statement When we use the program quot critquot you will be able to gure out what the print statement does gt critxquot22x l is a criticalpointfor x2 2 x So the value of 1 calculated in the first statement of the program is printed followed by the character string is a critical point f or note that both of the quotes that surround a character string are LEFT quotes on the keyboard to the left of the digit 1 and then the input expression is printed A TINY BIT OF PROGRAMMING We can improve crit so that it checks to see ifthe critical point is a local max or a local min using the second derivative test as follows gt critproc y local d dd c ddiffyx c solve d0 x print c is a critical point for y dddiff dx if subs xcdd gt0 then print It is a local minimum elif subsxcdd lt0 then print It is a local maximum else print The second derivative test is inconclusive for this point fi end crit pr0cy local d dd c d di fy x c solved 0 x primc is a critical point for y dd di td x if 0 lt subsx c dd then print It is a local minimum elif subsx c dd lt 0 then print It is a local maximum else print The second derivative test is inconclusive for this point end if end pros The fancy thing here is the quot if quot statement In fact it is an quot 47 ifthenelifthenelsefiquot statement You read quot elifquot as quotelse if The statement embodies the second derivative test If the second derivative dd at the point c is positive then c is a local minimum otherwise if dd is positive at c then c is a local maximum otherwise the test is inconclusive The quot fiquot at the end tells Maple that the if statement is over it is possible to have several statements after each quot thenquot and after the quotelsequot quotfiquot is quotifquot backwards sort of like aright parenthesis is to aleft one Here is the program at work gt critxquot22x 2 1 IS a critical paint for x 2 x It is a local minimum gt critxquot32x 6 f g isacriticalpoimforx3 2x Error in crit cannot determine if this expression is true or false 0 lt 2I6A12 2I6A12 Uhoh We told you it wouldn t always work This is because xquot 32 x has two complex critical points and our program hasn t made allowances for either the fact that the critical points might not be real nor that there might be more than one Here is a complete working version it still doesn t check for errors in the input but it39s not so bad You can look in books about Maple for all ofthe syntax or nd some of it in Maple help gt critprocy local d dd c cc ddiffyx c solve d0 x for cc in c do if type cc realcons then print cc is a critical point for y dddiff dx if evalf subs xcc dd gt0 then print It is a local minimum elif evalf subs xcc dd lt0 then print It is a local maximum else print The second derivative test is inconclusive for this point fi fi od end 48 crit procy local d dd c cc d dij y x c solved 0 x for cc in c do if typecc realcons then printcc is a critical point for y dd di fd x if 0 lt evalfsubsx cc dd then print It is a local minimum elif evalfsubsx cc dd lt 0 then print t is a local maximum else print The second derivative test is inconclusive for this point end if end do end prov It is nice that when Maple parrots the de nition of the program it formats the output so you can see where the various if s and do s begin and end Let39s try it out First on one that worked before gt critxquot22x 1 is a criticalpointfor x2 2 x It is a local minimum Now a better one gt critxquot32x No output That is right for as we know from before this function has no real critical points If we change it a little it will have two gt critxquot3 2x Isg is a critical pointfor x3 2 x It is a local minimum g is a criticalpointfor x3 2 x It is a local maximum Just as it should be 49 One place where you may want to write a program like this is to define quotpiecewisequot functions Here is an example from which you will get the idea gt fprocx if xlt2 then x 5 else 3 2xquot2 fi end f procx ifx lt 2 then x 5 else 3 2 2 end if end prov There are other ways to do thislook up the piecewise command for instance You have to be careful when plotting these functions For instance the following won t work gt plotfx x 1 4thickness2 Error in f cannot determine if this expression is true or false x lt 2 However as indicated in the section of this manual on the plot function the following does work gt plotf 1 4thickness2 4 0 1 2 3 4 IIIII IIIIIIIIIIIIIIIIIIII f is discontinuous at x 2 but the plot above shows a vertical line joining the right end of the line x S to the left end of 32 x 2 at X 2 making the function appear continuous 50 This happens because Maple makes it39s graphs by quotconnecting the dotsquotjoining a list of points on the function with short line segments You can usually force Maple to show discontinuities in a function by using the quotdisconttruequot option of the plot statement gt plot f 1 4 thickness2 disconttrue 1 0 1 2 3 4 llllllIlllllllllllllllllll Much better The other programming construction we will use occasionally even outside of programs is the quot f or f rom to do odquot statement It is used to make tables of functions and for repetition of a set of commands over and over For example a good table of sines and cosines obtained from the following gt for 1 from 1 to 8 do kPi4 cos kPi4 sin kPi4 od 1 l l 2 aw 51 gram1 2 151 1 2 4 2 2 27510 You getthe idea the statement kPi4cos kPi4 sir1kPi4 was executed for each value ofk from 1 to 8 The quot doquot and quot0dquot are used to surround what is allowed to be a set of several statements


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.