Main Content

release

Evaluate integrals

Syntax

Description

example

release(expr)evaluates the integrals in the expressionexpr. Thereleasefunction ignores the'Hold'option in theintfunction when the integrals are defined.

Examples

collapse all

Define a symbolic call to an integral cos ( x ) dx without evaluating it. Set the'Hold'option to true when defining the integral using theintfunction.

symsxF = int(cos(x),'Hold',真正的)
F =

cos ( x ) d x int(cos(x), x, 'Hold = TRUE', true)

Usereleaseto evaluate the integral by ignoring the'Hold'option.

G =释放(F)
G =
                      
                       
                        
                         
                          
                           sin
                         
                         
                          
                           (
                          
                           
                            
                             x
                           
                          
                          
                           )
                         
                        
                        
                         sin(x)
                       
                      

Find the integral of x e x dx .

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

symsxg(y)F = int(x*exp(x),'Hold',真正的)
F =

x e x d x int(x*exp(x), x, 'Hold = TRUE', true)

You can apply integration by parts toFby using theintegrateByPartsfunction. Useexp(x)as the differential to be integrated.

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

x e x - e x d x x*exp(x) - int(exp(x), x, 'Hold = TRUE', true)

To evaluate the integral inG, use thereleasefunction to ignore the'Hold'option.

Gcalc = release(G)
Gcalc =
                      
                       
                        
                         
                          
                           
                            
                             x
                            
                            
                            
                             
                              
                               e
                             
                             
                              
                               x
                             
                            
                           
                          
                          
                           -
                          
                           
                            
                             e
                           
                           
                            
                             x
                           
                          
                         
                        
                        
                         x*exp(x) - exp(x)
                       
                      

Compare the result to the integration result returned byintwithout setting the'Hold'option.

Fcalc = int(x*exp(x))
Fcalc =
                      
                       
                        
                         
                          
                           
                            
                             e
                           
                           
                            
                             x
                           
                          
                          
                          
                          
                           
                            
                             
                              
                               x
                              
                               -
                              
                               1
                             
                            
                           
                          
                         
                        
                        
                         exp(x)*(x - 1)
                       
                      

Find the integral of cos ( log ( x ) ) dx using integration by substitution.

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

symsxtF = int(cos(log(x)),'Hold',真正的)
F =

cos ( log ( x ) ) d x int(cos(log(x)), x, 'Hold = TRUE', true)

Substitute the expressionlog(x)witht.

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

e t cos ( t ) d t int(exp(t)*cos(t), t, 'Hold = TRUE', true)

To evaluate the integral inG, use thereleasefunction to ignore the'Hold'option.

H = release(G)
H =

e t cos ( t ) + sin ( t ) 2 (exp(t)*(cos(t) + sin(t)))/2

Restorelog(x)in place oft.

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

2 x sin ( π 4 + log ( x ) ) 2 (sqrt(sym(2))*x*sin(sym(pi)/4 + log(x)))/2

Compare the result to the integration result returned byintwithout setting the'Hold'option totrue.

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

2 x sin ( π 4 + log ( x ) ) 2 (sqrt(sym(2))*x*sin(sym(pi)/4 + log(x)))/2

Input Arguments

collapse all

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

Introduced in R2019b