% Problem 10 % Clear variables and declare x to be symbolic. clear syms x % a) int(sin(x), 0, pi/2) ans = 1 % The integral is 1, which we can easily check by hand. % b) int(x*cos(x^2)) ans = 1/2*sin(x^2) % That looks correct, let's check by differentiating the answer. diff(ans) ans = x*cos(x^2) % Bingo! % c) int(sin(3*x)*sqrt(1 - cos(3*x))) ans = 2/9*(1-cos(3*x))^(3/2) diff(ans) ans = sin(3*x)*(1-cos(3*x))^(1/2) % Right again. % d) int(log(x)) ans = x*log(x)-x diff(ans) ans = log(x) % And again. % e) int(x^2*sqrt(x + 4)) ans = 2/7*(x+4)^(7/2)-16/5*(x+4)^(5/2)+32/3*(x+4)^(3/2) diff(ans) ans = (x+4)^(5/2)-8*(x+4)^(3/2)+16*(x+4)^(1/2) % This time it's not so clear that the derivative of the integral % is equivalent to the original function. Let's simplify the answer % to make sure. simplify(ans) ans = x^2*(x+4)^(1/2) % That looks better. % f) int(sqrt(x^4 + 1)) ans = 1/3*x*(x^4+1)^(1/2)+int(2/3/(x^4+1)^(1/2),x) % This is rather difficult to read; let's make it easier with pretty. pretty(ans) / 4 1/2 | 1 1/3 x (x + 1) + | 2/3 ----------- dx | 4 1/2 / (x + 1) % It looks like MATLAB integrated by parts and performed some other % manipulations, then gave up; the answer is given in terms of another % indefinite integral. Nonetheless, we can differentiate this % expression. diff(ans) ans = 1/3*(x^4+1)^(1/2)+2/3*x^4/(x^4+1)^(1/2)+2/3/(x^4+1)^(1/2) % Again we have to simplify the answer. simplify(ans) ans = (x^4+1)^(1/2) % Correct! % g) int(exp(cos(x))) Warning: Explicit integral could not be found. > In /usr/local/matlab5/toolbox/symbolic/@sym/int.m at line 58 In /www/users/rll/courses/math246.f98/psa/probA10.m at line 67 ans = int(exp(cos(x)),x) % This is another integral that MATLAB can't perform symbolically. diff(ans) ans = exp(cos(x)) % Not suprising. % h) int(exp(-x^2), -inf, inf) ans = pi^(1/2) % The exact value of this definite integral is the square root of pi. echo off