release

Evaluate integrals

Description

example

release(expr) evaluates the integrals in the expression expr. The release function ignores the 'Hold' option in the int function when the integrals are defined.

Examples

collapse all

Define a symbolic call to an integral $\int \mathrm{cos}\left(\mathit{x}\right)\text{\hspace{0.17em}}\mathit{dx}$ without evaluating it. Set the 'Hold' option to true when defining the integral using the int function.

syms x
F = int(cos(x),'Hold',true)
F =

$\int \mathrm{cos}\left(x\right)\mathrm{d}x$

Use release to evaluate the integral by ignoring the 'Hold' option.

G = release(F)
G = $\mathrm{sin}\left(x\right)$

Find the integral of $\int \mathit{x}\text{\hspace{0.17em}}{\mathit{e}}^{\mathit{x}}\text{\hspace{0.17em}}\mathit{dx}$.

Define the integral without evaluating it by setting the 'Hold' option to true.

syms x g(y)
F = int(x*exp(x),'Hold',true)
F =

$\int x {\mathrm{e}}^{x}\mathrm{d}x$

You can apply integration by parts to F by using the integrateByParts function. Use exp(x) as the differential to be integrated.

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

$x {\mathrm{e}}^{x}-\int {\mathrm{e}}^{x}\mathrm{d}x$

To evaluate the integral in G, use the release function to ignore the 'Hold' option.

Gcalc = release(G)
Gcalc = $x {\mathrm{e}}^{x}-{\mathrm{e}}^{x}$

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

Fcalc = int(x*exp(x))
Fcalc = ${\mathrm{e}}^{x} \left(x-1\right)$

Find the integral of $\int \mathrm{cos}\left(\mathrm{log}\left(\mathit{x}\right)\right)\mathit{dx}$ using integration by substitution.

Define the integral without evaluating it by setting the 'Hold' option to true.

syms x t
F = int(cos(log(x)),'Hold',true)
F =

$\int \mathrm{cos}\left(\mathrm{log}\left(x\right)\right)\mathrm{d}x$

Substitute the expression log(x) with t.

G = changeIntegrationVariable(F,log(x),t)
G =

$\int {\mathrm{e}}^{t} \mathrm{cos}\left(t\right)\mathrm{d}t$

To evaluate the integral in G, use the release function to ignore the 'Hold' option.

H = release(G)
H =

$\frac{{\mathrm{e}}^{t} \left(\mathrm{cos}\left(t\right)+\mathrm{sin}\left(t\right)\right)}{2}$

Restore log(x) in place of t.

H = simplify(subs(H,t,log(x)))
H =

$\frac{\sqrt{2} x \mathrm{sin}\left(\frac{\pi }{4}+\mathrm{log}\left(x\right)\right)}{2}$

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

Fcalc = int(cos(log(x)))
Fcalc =

$\frac{\sqrt{2} x \mathrm{sin}\left(\frac{\pi }{4}+\mathrm{log}\left(x\right)\right)}{2}$

Input Arguments

collapse all

Expression containing integrals, specified as a symbolic expression, function, vector, or matrix.