Symbolic Programming in MATLAB:     Integration

The example code for symbolic integration:
 

» syms a b x        % multiple symbolic variables
» f = 3*a*b*x + 2*exp(a*x + b);        % define symbolic f

» f1 = diff(f,x)       % take the derivative of f with respect to x
f1 =
3*a*b+2*a*exp(a*x+b)

» int(f1,x)           % integrate f1 with respect to x
ans =
3*a*b*x+2*exp(a*x+b)       % recovered f - whew !!

» int(f,0,pi/2)   % integrate f with respect to default variable between 0 and pi/2
ans =
1/8*(3*a^2*b*pi^2+16*exp(1/2*pi*a+b)-16*exp(b))/a  % is this for real ? that look right to you ??

» f2 = int(f,b,0,pi/2)       % integrate f with respect to b between 0 and pi/2
f2 =
3/8*a*pi^2*x+2*exp(a*x+1/2*pi)-2*exp(a*x)    % that looks about right ?