diary probA10.txt
echo on

% Problem 10

% Clear variables and declare x to be symbolic.

clear
syms x

% a)

int(sin(x), 0, pi/2)
% The integral is 1, which we can easily check by hand.

% b)

int(x*cos(x^2))
% That looks correct, let's check by differentiating the answer.

diff(ans)
% Bingo!

% c)

int(sin(3*x)*sqrt(1 - cos(3*x)))
diff(ans)
% Right again.

% d)

int(log(x))
diff(ans)
% And again.

% e)

int(x^2*sqrt(x + 4))
diff(ans)
% 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)
% That looks better.

% f)

int(sqrt(x^4 + 1))
% This is rather difficult to read; let's make it easier with pretty.

pretty(ans)

% 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)
% Again we have to simplify the answer.

simplify(ans)
% Correct!

% g)

int(exp(cos(x)))
% This is another integral that MATLAB can't perform symbolically.

diff(ans)
% Not suprising.

% h)

int(exp(-x^2), -inf, inf)
% The exact value of this definite integral is the square root of pi.

echo off
diary off
