### Create a StudySoup account

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

Already have a StudySoup account? Login here

# ComputationLaboratoryIII CS123

Drexel

GPA 3.88

### View Full Document

## 37

## 0

## Popular in Course

## Popular in ComputerScienence

This 18 page Class Notes was uploaded by Vito Kilback on Wednesday September 23, 2015. The Class Notes belongs to CS123 at Drexel University taught by Staff in Fall. Since its upload, it has received 37 views. For similar materials see /class/212456/cs123-drexel-university in ComputerScienence at Drexel University.

## Reviews for ComputationLaboratoryIII

### 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/23/15

7 Chapter 17 Integration 391 7 Section 171 Recalling basic facts about integration We review some of the basic facts and terminology about integration from your calculus course De nite integration can be related to nding the area under a curve described by a function b The definite integral J fx dx L1 is notation for this If an answer for a de nite integration problem exists then it is a number which could be described exactly or approximated as with a calculator Inde nite integration is the problem of antidifferentiation That is given a function f we must nd another function F such that d dx Fx am We can write the previous relationship as the inde nite integral Jfx dxFx Sometimes the antiderivative Fx is written with an extra symbolic constant as in f x dx F x C particularly if antidifferentiation is going to be applied as only one step of a problemsolving process Since the hard part of doing indefinite integration is finding Fx without the constant and since the name of the constant can be freely chosen symbolic computation systems often omit the constant in their answers letting the user add in the constant of their choice later if they need to The answer Fx is expected to be a formula involving expressions and functions that the user already knows about Fx when it exists is referred to as a closed form solution to the integration problem For calculus freshmen these are expressions that involve numbers polynomials roots rational functions trig logarithm and exponential functions For more advanced mathematics students it might include other functions erf error function Ei exponential integral Bessel F etc The Fundamental Theorem of Calculus FTC states that we can evaluate a de nite integral in terms of an antiderivative via the formula b fx dxFb Fa where F is any function such that d a Fx i x Programs for doing inde nite integration have been around from the early 3960s They can be found in a number of symbolic systems Maple Mathematica Macsyma now found in SAGE and MuPad now found in the Symbolic Toolkit of Matlab V Section 172 Indefinite integration T Section 1 721 Doing antidi erentiation with 39i nt Figure 17211 Inde nite integration with int The clickable interface can be used to input an indefinite integration problem for Maple to compute Use the f dx item in the Expression Palette then edit the expression f and the variable of integration x The general form of the textual version of the integration command is int expression var This computes the antiderivative of the expression with respect to the variable var Example 17211 Inde nite integration with int Example Commentary 1 The clickable interface can be used to enter 7 dx x the integration problem lnx 1211 J39COSOC2 dx Note that in the clickable interface there are 1 1 two ways of entering what is quot E cosx sinx E x 1212 cosx cosxquot Jcos2x dx cosx sinx i x 1213 intsqrtx x The textual form of integration works in the 2 32 same way 3 x 1214 intcosoc sin 3 J on cos on cos 0c 1215 expr tan t XA 2 7 This uses the textual form ofthe command in l 7 t t a small script The script computes the l 7 Nil e pr symbolic integral and stores it in il Then it d1 1 d1 ff 11 r t takes the derivative ofil and assigns that to difference dl expr dl printquotdifferer1cequot According to the Fundamental Theorem of difference Calculus dl should be the same as eXpr However we have to get Maple to simplify di f f6 f ence I quot r the difference in order to have it actually be simplifydifference reducedto zerO printquotsimplified tant x2 lncost x2 t sint cost sint cost quotdifferencequot 781110 tant cost quotsimplified differencequot 0 x2 tant Section 1 722 Checking answers to integration problems with diff and simpli cation A simple strategy to check would can be describe as 1 Use int to calculate the answer 2 Apply diff to the answer to see by visual inspection if you end up with the integrand the original function you were trying to integrate 3 If the derivative does not look the same as the integrand try simplify on the difference between the result of step 2 and the original expression If you get zero the two are equivalent Example 17221 Checking answers Example Commentary expr l x 70082 l x cosx 1221 answer 1 intexpr x The derivative of the symbolic integral is the same as the original expression This is obvious just by quoteyeballingquot it but we can also confirm that the difference between expr and the derivative is 0 x i 2 i sinx 1222 2 2 dAnswer dz wnswer x l x cosx 1223 expr dAnswer 0 1224 expr sinx2 The derivative of thle symbotlic lltlltegral does t t t t t Sinx2 1225 no appear a 1rs g ance o e e same as answer 1 intexpr x the original expression However the difference between them does simplify to zero so they are equivalent Maple does not automatically employ trig identities such as sin2a cos2a 1 because it would often introduce tedious delay to try to apply all possible identities all the time cosx sinx i x 1226 dAnswer dz mnswer x 1 2 1 2 1 2 s1nx 2 cosx 2 1227 d expr dAnswer 1 2 1 2 1 2 s1nx 2 cosx 2 1228 simplz d 0 1229 expr1 xA2 lxl 12210 Here is another example of a symbolic integration answer whose derivative does not appear to be the same as the starting x2l 12210 x 1 answer 1 intexpr x x2x21nx 1 12211 dAnswer dz answer x l 12212 x x 1 simplz expr dAnswer 0 12213 expression However simplification of the difference between the two indicates that the two are equivalent because their difference simpli es to zero Sometimes the quotsimplify the difference to zero39 39 trick is not needed to check work because it is obvious that the two are the same Maple has other simplification functions that will attempt to put results into alternative forms Example 17222 Using normal with the expanded option to manipulate answers Commentary Example 2 answer 1 3x x 2 dx 3 x x 3 x l 2 2 3 g lnx l g arctanx 12214 7 15 ln3 x l dAnswer dz answer x 1 2x 12215 5 x 1 5 x 1 4 5 3 x 1 normalalAnswer 2 2x2 12216 x 1 3 x 1 normaldAnswer expanded 2 2 12217 3 x x 3 x l simplz d dAnswer 2 x 9 2 12218 x2l 3x l normal does a specific kind of simplification it tries to combine expressions that have symbolic numerators and denominators into a standard form By default normalexpr tries to keep numerators and denominators of expr that are factored as products of expressions rather than expanding everything out normal expr expandea will try to expand them In this situation normalexpanded is the way to show that dAnswer is mathematically equivalent to the integrand simplify does only what ordinary normal does so we couldn39t use it to show the equivalence of dAnswer and answer l dA x2 x 2 simplify is still useful for quotsubtract the two Sim l mwer 3 x3 x2 3 x 1 expressions and show that the difference is 0 12219 equ1valent to zero as we were domg 1n Example 17221 though V Section 1 723 Limitations of symbolic integration program The ideas for how to program an inde nite integrator comes from seminal work done by Robert Risch in the late 1960s who was in turn continuing work done previously by other mathematicians Earlier approaches treated symbolic antidifferentiation as a problem in arti cial intelligence Those programs such as SAINT by James Slagle and SIN by Joel Moses in the 1960s tried to simulate the expertise of a college calculus student However they would sometimes give up on problems that could be solved through a clever trick of substitution or other reformulation Risch s work used advanced mathematics to come up with programs that would guarantee that they could find a solution if there was one to be found for certain classes of integrands However while programs produce an answer it is not necessarily in the same form as given by a mathematics textbook although it would be equivalent or differ only by a constant Work since that time has improved the power of symbolic integration programs While they are now better than most people in most situations they are not omnipotent This also doesn t change the fact that there are many integration problems for which there is no closed form solution This is seen in two ways by users of computation systems such as Maple 1 Sometimes the answer given by the symbolic integrators will be given in terms of functions that beginning students haven t heard of This can be confusing but most systems do not have a quotbeginners modequot that avoids using hard math If you see a function you don t know of Maple will provide a description of such function if you type the function name into its online help Whether or not the answer in this form is satisfactory for you depends on the situation If it s for classroom use and they want you to find answers that have only quotfreshman calculus functionsquot eg trig functions logarithms polynomials exponential functions then you may have concluded that you can t express the answer using only functions that have been introduced in the course so far If it s a situation on the job it may be worthwhile to follow the answer as far as you need to in order to get the job done even if it goes beyond the math you already know Most of the integration problems we will pursue in this course are not going to force us to go that far If Maple cannot find an answer it will return an expression that is the display version of the input expression It does this instead of giving an error message or NULL so that a program using integration can continue even if the attempt to integrate fails For example even if you don t have the antiderivative of the integrand you might want to do approximate definite integration with it see section 172 N To summarize the responsibilities that users of symbolic integration programs have are a to be prepared to learn about more advanced functions if answer is of that form and they need to work with it and b understand when the computer system is telling them that it can t nd a closed form solution Example 17231 Integration answers using advanced functions J e 2 dx 15 erflx 1231 You wouldn39t see this integration problem in an elementary calculus textbook because the answer involves the quoterror functionquot The term quoterror functionquot is not indication that there is a mistake but refers to the function s use in probability and statistics You can read more about the error function by typing quoterfquot or quoterror functionquot into Maple39s online help m1 1 Ioguf t Ei1 1nt mm 1232 The quotEiquot function is referred to as the quotexponential integral functionquot x6x3 1 dx x 1x52x1 J 1 x4 7RRoot0f1 1317725 711317724 9600 723 7 950 7R1nx 349074238374535 4 888570355100224 121804780837461 888570355100224 28294770316097 222142588775056 7796211858445 13883911798441 8123093952608 13883911798441 3 2 1nx 1 This a situation where there is a closed form solution but it involves the roots of a polynomial that cannot be expressed in terms of conveng iza sguare roots cube roots nth roots tc The answer includes a sum over all the 4z roes73 i dn p1e39 or real of the polynomial equation 1317 725 11317724 9600 723 9504 722 17984 72 32512 fso1ve 1317 25 11317 24 9600z3 9504 Z2 17984 Z 32512 Z comp1 ex says that these roots have the approximate values 1060190349 006877225771 13885265691 iZ 006877225771 1388526569 I 1098867432 04410400875 I 1098867432 044104008751 This is one of those situations where it will be difficult to get much use out of the symbolic answer If you are really doing a definite integration problem involving this integrand pursuing an approximation to the definite integral as discussed in Section 172 may be a better ploy Example 17132 Integration answers when Maple can39t nd an expression for the anti derivative answer 1 int f x x Maple can t nd the antiderivative because If dx 1 2 3 4 we haven t told it what the function f is answer2 int g t t It can t nd the symbolic integral for g either for the same reason We see thatprz39ntfsays that the value of answer2 is in textual form the same as the input was Expression 1234 would print out the same way if we used print rather than Maple39s default 2d math output to display that result printfquotThe answer was aquotanswer2 IgU dt the answer was intgtt int 1 sqrtlogsinx l expx x Here s another example of an integral that 1 Maple can t do even though the expression dx 1235 being integrated is something that it lnsinx l ex recognizes V Section 1 724 int doesn39t work on functions only expressions int only works with expressions not names of functions You wouldn39t expect to input Isin dx and expect to get an answer since just quotsinquot doesn39t mention any variable to integrate with respect to You would expect only sinx dxto work In a similar fashion symbols that are assigned expressions as values rather than function definitions can be used successfully with int Example 17241 Variables assigned expressions work with int but not variables assigned function definitions COS dt Symbolic integration seems to suggest that the integral of cosine with respect to t is cos cost 1241 t But Maple would display that as quotcost quot not quotcos tquot The answer is a lookalike which can be confusing a dt a t eval1241 t 0 0 eval1241 t 5 05 cos cost dt sint eval1245 t 0 0 eval1245 t 5 04794255386 1242 1243 1244 1245 1246 1247 Note that the answer looks similar to what happens when we integrate a symbol that doesn39t depend on t the symbol times t One way to demonstrate that this answer isn39t cost is to evaluate it at t0 That certainly isn39t the value of cosO Evaluating this expression for another value indicates that Maple39s integration result is actually quottcosquot the variable t times the name of a function Giving the symbolic integrator an expression in I gives a proper result g x gt xAZ x rx intg x gx intgx x intgt t ml NL intgy x to 1248 1249 12410 12411 12412 Another mistaken attempt to integrate a function name instead of an expression involving the integration variable Like the example above it produces the answer quotg times xquot Note that the value of g is not the expression xAZ it s the function definition x gt xA2 Evaluating gx does produce x2 which int can integrate properly Evaluate gt produces an expression in t which int can integrate properly if it is given that as the variable of integration This is the integral of y2 with respect to x x times y2 intabsb b 12 b blt0 2 2 0ltb ml procAbs pr0cx if x Z 0 then return x else 12413 Integrating the absolute value function returns a piecewise expression We write a Maple procedure to emulate the absolute value function 1 return x end if end procx 12414 if 0 ltx then return x else return x But it doesn39t work This is because the if d f statement gives an error when it tries to en I decide whetherx is greater than zero when end PI 0c there is no numerical value forx intprocAbsb b Error in procAbs We are not saying that you can t use a function de ned through a Maple procedure in symbolic integration If the procedure can execute and return a symbolic expression even if its arguments are symbols then there is no problem cannot determine if this expression is true or false 0 lt b procNew procx evalexpx a a 2x nd This computes the integral of expyl yl Note that we could use it to calculate the integral of expz2z expw2w etc in a similar fashion procx 12415 evalexpx a a 2 x end proc intprocNewy ly 2 ey 1 y 12416 V Section 172 Definite integration Figure 1721 De nite integration with int The clickable interface can be used to input a definite integration problem for Maple to compute Use the f dx item in the Expression Palette then edit the expressions f a and b and the variable of integration x to suit your problem The general form of the textual version of the command is int expression var ab If the answer to a definite integration problem returns as the symbolic answer then doing evalf of it will produce an approximation to the area using techniques that do not require symbolic integration to nd the answer Approximation techniques will also be used if integrand or the limits of integration involve oating point numbers rather than exact fractions Example 1721 De nition Integration examples Example Commentary Anton Calculus 8th ed problem 6514 Calculate 7T 5 3 3 2 J 6dtJ sinx dxJ x 2 dxJ x 4 x2 dx 710 n 0 0 3 5 I 6 710 131 Tc Tc mts1nxx7 3 3 J 0 132 3 J x 2 dx 0 5 3 133 intsqrt4 XA2XO2 TE Using the clickable interface Using the document interface but with the textual form of the operation Using the clickable interface again Entry of the operation within a code edit region Anton problem 6625 Calculate 4 3 3 5J7 t 2dt 1 J7 int3sqrtt 5 sqrtt tA 32 t 1 4 55 i 134 3 Anton problem 32 a Calculate 3 L 7 x2 l arctanl39 283 x2 l dx Answer should be 30 intabsx 2 l15xA2 1x33 23g 30 arctan3 60 arctan2 135 simply 13S 30 arctan 23g 136 The original form of the answer given y Maple does not match the answer key but fortunately the simplify function reduces the result to the desired form This does not always happen for de nite integration results Sometimes further manual operation may be necessary Anton problem 32 b Calculate J T 1 J 2 dx usmg Theorem 655 L i x l x2 i C which states thatfora lt b lt c Jfx dx 1 b c J x dxJfx d96 a b You will nd it necessary to choose a good splitting point try plotting the function and finding where it is zero expr1 abslsq1tlx 2 sqrt2 1 id l x2 intexprx0sqrt32 a L plotexpr x 0 sq1t3 2 2 137 138 dx It usually doesn39t hurt to see if Maple39s software has advanced to the point where it can do the problem all by itself But we see here that since the result is the same as the input that Maple can t do the problem without help Plotting the function suggests that there s quite a change occurring around 07 This point is probably the splitting point that the problem is suggesting we find But what is it exactly 05 04 03 02 01 071 072 0393 0394 0395 0396 0397 0398 x zeroes solve expr 0 x weaken 139 splitPt solve expr 0 x gt 0 x 1x 1 n bpt evalx 1310 1310 Giving solve the problem of where the function is zero gives us two solutions One is negative and we don t care about it since our de nite integral is looking at the function only between 0 J and Recall from section 91 that we can omit unwanted solutions by including inequalities that force solve to only consider positive solutions We can extract the value of the positive root from the solve result by H 1311 evaluating the solve result at x E hp 2 J exprdxJ exprdx 0 hp We use the splitt1ng idea to ask Maple 1 1 to evaluate two de nite integrals It E 7 2 E 1312 can do each piece 5 x7 x5 x Anton 6646 Calculate fdx Plot x x 7 the function on the interval How does the picture con rm the calculation int xA7xA5 x xA4 xA2 7 x 5 5 0 1313 plot xA7xA5 x xA4 xA2 7 x5 5 The function is quotoddquot fX fX So the positive area between 0 to 5 is 100 50 100 exactly cancelled by the negative area between 5 and 0 co 1 2 Anton Example 4 ch 8 Evaluate l x 700 co I 1 70 lx2 Anton Example 6 c Ch 8 Evaluate l J dx 0 1x11 dx 7 1314 answer intl sqrtx xl x O infinity printfquotsin evaluated at the answer is aquot sinanswer TE sin evaluated at the answer is 0 Maple can do improper de nite integrals since it can do symbolic limits e g the functionality available through limit You can input in nity by through the quotCommon Symbolsquot palette that can be found on the left hand side of the Maple application window Infinity is can also be input textually as the symbol 1 nfi n i ty Example 1722 Approximate definite integration examples expx2 int 72 x2 3 10gx 3 6x2 L lnx2 dx evalf1315 6941492846 1315 1316 Tx230 6941492846 1317 expx2 7 J mt xil3 10gx2 3 6x2 7 dx 1318 J1 lnx2 evalf1318 Float 00 1319 Maple is unable to calculate the exact solution to this definite integration problem evalf says that the area is approximately 69415 Note that the difference between this and the original input was that we have changed the upper limit of integration from quot3quot to quot30quot ecause this is a oating point number Maple will use evalf automatically This is the same integrand Note that the lower limit of integration is where the integrand is infinite Not surprisingly the approximation method doesn39t give us a number for the answer Since the approximation method doesn39t guarantee that its answer is close to the actual answer this result doesn39t prove that the area under the curve is infinite Further analysis by a mathematician might establish this conclusively 6 m x 2x 1 RRoonfLZ3 2722 1 25 R10 R2ln 13 1320 7R 37R4 g 12 7 3 2 7137130onsz 272 1 1 2 5 R 7R 37R4 107132 lnl 7R There is a symbolic solution to the integral but it s messy An explanation of quotRootOfquot can be found in Example 17132 As with the integrand above making the upper limit of integration into a oating point number invokes the approximation technique that evalf uses

### 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

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "I made $350 in just two days after posting my first study guide."

#### "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."

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION 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 support@studysoup.com

#### STUDYSOUP REFUND POLICY

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: support@studysoup.com

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 support@studysoup.com

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.