MATLAB Answers

unable to integrate acos(function)

조회 수: 2(최근 30일)
Giovanni Bressan
Giovanni Bressan 2020년 10월 27일
편집: Karan Nandankar 2020년 12월 30일
Hi, I am using the symbolic math toolbox to find an expression for the sine of an angle I do have the cosine of, defined as such:
syms theta_Za cos_theta_Zb phi_Za N theta_ab phi_ab theta_b phi_b real
Tay_ord = 5 %truncation order for the Taylor series expansion
A = 3/(8*pi)*sin(theta_Za)*sin(theta_ab)*exp(-1i*(phi_Za-phi_ab));
B = 3/(4*pi)*cos(theta_Za)*cos(theta_ab);
C = 3/(8*pi)*sin(theta_Za)*sin(theta_ab)*exp(1i*(phi_Za-phi_ab));
cos_theta_Zb = ((4*pi)/3)*(A+B+C);
So the most straightforward way of doing this was to include in the expression I need (polX_b) the sine of the arccosine of cos_theta_Zb:
polX_b = (1-exp(-N.*sin(acos(cos_theta_Zb))*cos(phi_b)));
Although, MATLAB does not seem to handle this properly and when I try to include polX_b in the calculation I am interested to perform (Taylor series expansion followed by term by term integration of a product of polX_b and three other (1-exp(...)) expression) I cannot find a closed form solution of the integral. Code shown below:
polZ_a = (1-exp(-N.*cos(theta_Za)));
polZ_b = (1-exp(-N.*(cos_theta_Zb)));
polX_a =(1-exp(-N.*(sin(theta_Za)*cos(phi_Za))));
ZZXX_2_osc = (polZ_a)*(polZ_b)*(polX_a)*(polX_b);
Tay_ZZXX_2_osc = (taylor(ZZXX_2_osc,N,0,'Order',Tay_ord));
int_theta_Tay_ZZXX = simplify((int(Tay_ZZXX_2_osc*sin(theta_Za), theta_Za, [0 pi],'IgnoreAnalyticConstraints',true)))
What could be the most convenient way of fixing this script?
Thanks a lot in advance


Karan Nandankar
Karan Nandankar 2020년 12월 30일
편집: Karan Nandankar 2020년 12월 30일
As I can see you are approximating your function 'ZZXX_2_osc' over variable 'N' in taylor expansion, while the integration variable is set as 'theta_Za'. This is probably the reason we are getting an unresolved integral, and int is unable to compute its closed form.
I tried approximating the function over variable 'theta_Za' and that worked for me.
%Approximation using Taylor
tay_ZZXX_2_osc = taylor(ZZXX_2_osc, theta_Za, 'ExpansionPoint', 0, 'Order', Tay_ord);
% Integration
int_theta_Tay_ZZXX = simplify((int(tay_ZZXX_2_osc*sin(theta_Za), theta_Za, [0 pi],'IgnoreAnalyticConstraints',true)))
Hope this helps in your workflow.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by