%% Exponential Function
% Apply integration by parts to the integral \int x^2 \;e^x \textrm{dx}.
% Define the integral using the int function. Show the result without evaluating the integral by setting the 'Hold' option to true.

syms x
F = int(x^2*exp(x),'Hold',true)

% To show the steps of integration, apply integration by parts to F and use exp(x) as the differential to be integrated.

G = integrateByParts(F,exp(x))
H = integrateByParts(G,exp(x))

% Evaluate the integral in H by using the release function to ignore the 'Hold' option.

F1 = release(H)

% Compare the result to the integration result returned by the int function without setting the 'Hold' option to true.

F2 = int(x^2*exp(x))

%
% Copyright 2019 The MathWorks, Inc.