Find the Definite Integral of Arccos Function in Matlab | Integral Problem

  • Context: MATLAB 
  • Thread starter Thread starter amykelly36
  • Start date Start date
  • Tags Tags
    Integral Matlab
Click For Summary
SUMMARY

The discussion focuses on calculating the definite integral of the function arccos(sqrt(1+x)/10)/(sqrt(x)*x^(2/3)) over the interval [0, pi/2] using MATLAB. The user encountered an error while attempting to use the int() function, which indicated that the expression could not be converted into a double array. A solution was provided, recommending the use of the quadl() function for numerical evaluation, along with the correct syntax for defining the function with elementwise operations.

PREREQUISITES
  • Familiarity with MATLAB syntax and functions
  • Understanding of symbolic mathematics in MATLAB
  • Knowledge of numerical integration techniques
  • Basic understanding of the arccos function and its properties
NEXT STEPS
  • Learn how to use MATLAB's quadl() function for numerical integration
  • Explore MATLAB's symbolic toolbox for advanced symbolic computations
  • Study the differences between symbolic and numerical integration in MATLAB
  • Investigate the use of elementwise operations in MATLAB for vectorized calculations
USEFUL FOR

Mathematics students, MATLAB users, engineers, and anyone involved in numerical analysis or symbolic computation who needs to evaluate complex integrals.

amykelly36
Messages
2
Reaction score
0
I want to find the definite integral of

arccos(sqrt(1+x)/10)/(sqrt(x)*x^(2/3))​

,over [0,pi/2].

I ran the following code in Matlab,

"syms w

double(vpa(int(acos((w + 1)^(1/2)/10)/(w^(1/2)*(w + 1)^(3/2)),w,0,pi/2)))"

and got this error message,

"? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a
double array.

If the input expression contains a symbolic variable, use the VPA function
instead.

Error in ==> sym.sym>sym.double at 936
Xstr = mupadmex('symobj::double', S.s, 0);

Error in ==> HW at 4
double(vpa(int(acos((w + 1)^(1/2)/10)/(w^(1/2)*(w + 1)^(3/2)),w,0,pi/2)))".

Anybody has met such situation like me before? I appreciate any comment!
 
Physics news on Phys.org
Hello there! I think that int() cannot be used here, since the integral will need to be evaluated numerically. Try using quadl() instead:

Code:
this = @(w)acos((w+1).^(1/2)/10)./(w.^(1/2).*(w+1).^(3/2)); % note the elementwise operations (.^, ./, .*)

quadl(this,0,pi/2)

Hopefully that helps!
 
Thanks a lot! It exactly settles the issue.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
2
Views
8K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 6 ·
Replies
6
Views
2K