# ------------------------------------------------------------------ # Math 1225 Laboratory Assignment #3 March 10, 1999 # Treibergs Due March 24, 1999 # ------------------------------------------------------------------ # SYMBOLIC INTEGRATION # MAPLE knows methods for integrating functions and can sometimes integrate functions which # are painful to do by hand. We will explore some features about symbolic integration. These # problems are inspired by section 8.7 of the text. We will use MAPLE's student package which # has procedures that show integration step by step. > with(student): # SUBSTITUTION # We consider solving integration problems using the substitution method. "Int(f(x),x)" # means an unevaluated integral of f(x) with respect to x. Start wth the integral on p409[69] > Int(sin(x)*cos(x)/sqrt(3*sin(x)+5),x); / | sin(x) cos(x) | ----------------- dx | 1/2 / (3 sin(x) + 5) # "changevar(f(x)=g(u),expession_in_x);" or "changevar(f(x)=g(u),expession_in_x,u);" # solves for "u" as a function of "x" and replaces occurances of "x" in "expression_in_x" # with the "u" form. Here we substitute the innermost quantity u = 3*sin(x) + 5 into the # expression which is the previous unevaluated integral. MAPLE automatically figures out # "sin(x) = (u-5)/3" and "du=3*cos(x)dx". "Expand" and "simplify" combines like terms. > changevar(3*sin(x)+5=u,"); / | - 5/3 + 1/3 u | 1/3 ------------- du | 1/2 / u > expand("); / / | 1 | 1/2 - 5/9 | ---- du + 1/9 | u du | 1/2 | / u / # "value" will evaluate the expression. Note that MAPLE does not add "+C" to its indefinite # integrals. > value("); 1/2 3/2 - 10/9 u + 2/27 u # Then we change back to the original variables, > changevar(u=3*sin(x)+5,"); 1/2 3/2 - 10/9 (3 sin(x) + 5) + 2/27 (3 sin(x) + 5) # Then check by differentiating. "normal" recombines an expanded expression. > normal(diff(",x)); sin(x) cos(x) ----------------- 1/2 (3 sin(x) + 5) # # We go again, this time on 409[56]. We continue until we reach standard forms. Then use the # MAPLE instruction "value" to finally evaluate the integral. > Int((3-x)/sqrt(16-6*x-x^2),x); / | 3 - x | ------------------ dx | 2 1/2 / (16 - 6 x - x ) > completesquare(",x); / | 3 - x | -------------------- dx | 2 1/2 / (- (x + 3) + 25) > changevar(x+3=u,"); / | 6 - u | -------------- du | 2 1/2 / (- u + 25) > I1:=expand("); / / | 1 | u I1 := 6 | -------------- du - | -------------- du | 2 1/2 | 2 1/2 / (- u + 25) / (- u + 25) # The second term can be simplified > Int(u/sqrt(25-u^2),u); / | u | -------------- du | 2 1/2 / (- u + 25) > changevar(25-u^2=v,"); / | 1 | - ------ dv | 1/2 / 2 v > value("); 1/2 - v # We have reached the standard forms from the flyleaf table #2 and #16. "I1" becomes > value(I1); 2 1/2 6 arcsin(1/5 u) + (- u + 25) > changevar(u=x+3,"); 2 1/2 6 arcsin(1/5 x + 3/5) + (- (x + 3) + 25) # Again, check the answer by differentiating. We again get the integand. > normal(diff(",x)); - 3 + x - ------------------ 2 1/2 (16 - 6 x - x ) # INTEGRATION BY PARTS # MAPLE can be directed to do integrations by parts. Suppose we consider the expression > ex1:= x^2*exp(3*x); 2 ex1 := x exp(3 x) # First we integrate the expression ex1 using the "int(f(x),x);" indefinite integration of f(x) # with respect to the x variable. (MAPLE does not print "+C" for indefinite integrals.) > int(ex1,x); 2 1/3 x exp(3 x) - 2/9 x exp(3 x) + 2/27 exp(3 x) # To follow how this is done step by step, we can integrate by parts one time # using the "intparts(Int(f(x),x),g(x),x);" instruction. > Int(ex1,x); / | 2 | x exp(3 x) dx | / # This is the first argument of intparts. The second is the term to be differentiated in an # integration by parts. Thus, differentiating the "x^2" term in integrating by parts yields > intparts(Int(ex1,x),x^2,x); / 2 | 1/3 x exp(3 x) - | 2/3 x exp(3 x) dx | / # "intparts" only integrates the part of the expression which is the integral and carries the rest # of the expression along. Thus integrating by parts a second time, where "x" is the # differentiated term and a third time where "1" is the differentiated term yields the answer. > intparts(",x); / 2 | 1/3 x exp(3 x) - 2/9 x exp(3 x) + | 2/9 exp(3 x) dx | / > intparts(",1); / 2 | 1/3 x exp(3 x) - 2/9 x exp(3 x) + 2/27 exp(3 x) - | 0 dx | / # Sometimes you have to solve for the integral after integrations by parts. For example, we take # for the second expression, and we take its integral all at once to get > ex2:= sin(3*x)*exp(4*x); ex2 := sin(3 x) exp(4 x) > int(ex2,x); - 3/25 exp(4 x) cos(3 x) + 4/25 sin(3 x) exp(4 x) # Now, instead, lets integrate by parts twice and solve for the integral. > ZZ=Int(ex2,x); / | ZZ = | sin(3 x) exp(4 x) dx | / > intparts(",sin(3*x),x); / | ZZ = 1/4 sin(3 x) exp(4 x) - | 3/4 exp(4 x) cos(3 x) dx | / > intparts(",cos(3*x),x); ZZ = 1/4 sin(3 x) exp(4 x) - 3/16 exp(4 x) cos(3 x) / | + | - 9/16 sin(3 x) exp(4 x) dx | / # "simplify" tells MAPLE to try to combine stuff together to shorten the expression. # "subs(A=B,C);" tells MAPLE to substitute expression B for A in C. Then solve for the # integral. > simplify("); ZZ = 1/4 sin(3 x) exp(4 x) - 3/16 exp(4 x) cos(3 x) / | - 9/16 | sin(3 x) exp(4 x) dx | / > subs(Int(ex2,x)=ZZ,"); ZZ = 1/4 sin(3 x) exp(4 x) - 3/16 exp(4 x) cos(3 x) - 9/16 ZZ > solve(",ZZ); - 3/25 exp(4 x) cos(3 x) + 4/25 sin(3 x) exp(4 x) # INTEGRATION BY PARTIAL FRACTIONS # MAPLE can convert a rational function to partial fractions. For example. > ex4:=(x^3+x^2+x+4)/(x^4-1); 3 2 x + x + x + 4 ex4 := --------------- 4 x - 1 > ex5:=convert(ex4,parfrac,x); 7 3 3 ex5 := --------- - --------- - ---------- 4 (x - 1) 4 (x + 1) 2 2 (x + 1) > int(",x); 7/4 ln(x - 1) - 3/4 ln(x + 1) - 3/2 arctan(x) > int(ex4,x); 7/4 ln(x - 1) - 3/4 ln(x + 1) - 3/2 arctan(x) > ex6:=1/(217*x^4-60*x^5+36*x^6-556*x^3+586*x^2-1056*x+1089); 1 ex6 := -------------------------------------------------------- 4 5 6 3 2 217 x - 60 x + 36 x - 556 x + 586 x - 1056 x + 1089 > convert(ex6,parfrac,x); 16 704 323 + 264 x --------------- - ---------------- + 4/571787 --------------- 2 571787 (2 x - 3) 2 6889 (2 x - 3) 3 x + 2 x + 11 37 + 132 x + 1/6889 ------------------ 2 2 (3 x + 2 x + 11) # To see how to find the denominators of such an expression, we can factor it. > factor(ex6); 1 ----------------------------- 2 2 2 (2 x - 3) (3 x + 2 x + 11) # WHY YOUR ANSWER DOES NOT ALWAYS AGREE WITH THE BACK OF THE BOOK # Suppose we wish to find the indefinite integral of sin(5*x)*cos(6*x). We will find several # different looking expressions z1, z2, z3 for this integral, each of which turns out to be the # same function. # > ex8:= sin(5*x)*cos(6*x); ex8 := sin(5 x) cos(6 x) > z1:=int(ex8,x); z1 := - 1/22 cos(11 x) + 1/2 cos(x) # Now, we do some manipulation before integrating. > simplify(ex8); 10 8 6 512 sin(x) cos(x) - 1152 sin(x) cos(x) + 896 sin(x) cos(x) 4 2 - 280 sin(x) cos(x) + 30 sin(x) cos(x) - sin(x) > z2:=int(",x); 512 11 9 7 5 3 z2 := - --- cos(x) + 128 cos(x) - 128 cos(x) + 56 cos(x) - 10 cos(x) 11 + cos(x) # To see that "z1" and "z2" are both antiderivatives, we check that their difference is a constant. > z1-z2; 512 11 9 7 - 1/22 cos(11 x) - 1/2 cos(x) + --- cos(x) - 128 cos(x) + 128 cos(x) 11 5 3 - 56 cos(x) + 10 cos(x) > simplify("); 0 # For a third version, lets integrate by parts twice and then solve for the integral as we did # before. > VI=Int(ex8,x); / | VI = | sin(5 x) cos(6 x) dx | / > intparts(",sin(5*x),x); / | VI = 1/6 sin(5 x) sin(6 x) - | 5/6 cos(5 x) sin(6 x) dx | / > intparts(",cos(5*x),x); VI = 1/6 sin(5 x) sin(6 x) + 5/36 cos(5 x) cos(6 x) / | 25 + | ---- sin(5 x) cos(6 x) dx | 36 / > subs(Int((25/36)*ex8,x)=(25/36)*VI,"); 25 VI = 1/6 sin(5 x) sin(6 x) + 5/36 cos(5 x) cos(6 x) + ---- VI 36 > z3:=solve(",VI); z3 := 6/11 sin(5 x) sin(6 x) + 5/11 cos(5 x) cos(6 x) > z1-z3; - 1/22 cos(11 x) + 1/2 cos(x) - 6/11 sin(5 x) sin(6 x) - 5/11 cos(5 x) cos(6 x) > simplify("); 0 # PROBLEMS FOR LAB #3. # 1. Using "changevar" and "completesquare", simplify the integral # "Int(1/sqrt(16+6*x-x^2),x)" until you reach one of the forms in the TABLE of integrals at # the end of the text. Identify which form it is, then use "value" to find the indefinite integral. # Complete the integration by substituting back to the original variables using "changevar" # again. Check by differentiating your expression to show that it equals the original integrand. # 2. Find the integral of "x^3*exp(5*x)" in two ways. Use "int" and use repeated integrations # by parts "intparts" by always differentiating the "x" term. # 3. For the expression "ex3:= exp(a*x)*sin(b*x);" find the indefinite integral using "int". # Then show this in more detail by integrating by parts twice and solving for the integral. # Compare your answer to 428[57] of the text. MAPLE can handle arbitrary constants as well # as numbers. # 4. Convert "(x^5-5*x^4+10*x^3-10*x^2+5*x-1)/(x^5-57*x^4+1299*x^3- # 14795*x^2+84216*x-191664)" to partial fractions. Use the result to find the indefinite # integral. (See 440[2d].) # 5. Find your own function for which you can coax MAPLE into giving two different expressions # for the indefinite integral. Then use MAPLE to check that your two expressions differ by a # constant. (Everybody should have a different function for this problem!)