How to calculate a composite triple integral with exponential function?

Hello! I have a composite triple integral, but i cant find a proper approach to calculate it.
,where the variables are "r","s","l".
r0 is a known constant.
I try to use integral3, but the exp() and the variable 'l' for the lower bound of the integral makes it hard to calculate.
Is there any other matlab function that is suitable to solve this composite triple integral? I would appreciate it if anyone could give me some advice.

6 Comments

Please share what you have tried yet.
Additionally, do you have the Symbolic Math Toolbox?
Please make clear which integral limits belong to which integration variable.
I have tried one way with "int" function. Although it can run, it does not have a valid value of "int_out".
syms s r l
r0=100;
int_r_object=(1+s.*r.^-2).^-2.*r;
int_r=int(int_r_object,r,l,r0);
int_s_object=exp(-s)./s.*exp(int_r).*(1+s.*l.^-2).^-1;
int_s=int(int_s_object,s,0,+Inf);
int_out=int(int_s,l,0,r0);
Another try is with "integral" funcion
r0=100;
int_r=@(s,d00) integral(@(r) 1+s.*r.^-2, d00, 100);
int_out=integral2(@(s,l) exp(-s)./s.*exp(int_r).*(1+s.*l.^-2).^-1,0,+Inf,0,r0);
Incorrect number or types of inputs or outputs for function exp.

Error in solution>@(s,l)exp(-s)./s.*exp(int_r).*(1+s.*l.^-2).^-1 (line 3)
int_out=integral2(@(s,l) exp(-s)./s.*exp(int_r).*(1+s.*l.^-2).^-1,0,+Inf,0,r0);

Error in integral2Calc>@(y)fun(xi*ones(size(y)),y) (line 18)
@(y)fun(xi*ones(size(y)),y),y1i,y2i,opstruct.integralOptions), ...

Error in integralCalc>iterateScalarValued (line 334)
fx = FUN(t);

Error in integralCalc>vadapt (line 148)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen, ...

Error in integralCalc (line 77)
[q,errbnd] = vadapt(vfunAB,interval, ...

Error in integral2Calc>@(xi,y1i,y2i)integralCalc(@(y)fun(xi*ones(size(y)),y),y1i,y2i,opstruct.integralOptions) (line 17)
innerintegral = @(x)arrayfun(@(xi,y1i,y2i)integralCalc( ...

Error in integral2Calc>@(x)arrayfun(@(xi,y1i,y2i)integralCalc(@(y)fun(xi*ones(size(y)),y),y1i,y2i,opstruct.integralOptions),x,ymin(x),ymax(x)) (line 17)
innerintegral = @(x)arrayfun(@(xi,y1i,y2i)integralCalc( ...

Error in integralCalc>iterateScalarValued (line 334)
fx = FUN(t);

Error in integralCalc>vadapt (line 148)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen, ...

Error in integralCalc (line 88)
[q,errbnd] = vadapt(vfunA,interval, ...

Error in integral2Calc>integral2i (line 20)
[q,errbnd] = integralCalc(innerintegral,xmin,xmax,opstruct.integralOptions);

Error in integral2Calc (line 7)
[q,errbnd] = integral2i(fun,xmin,xmax,ymin,ymax,optionstruct);

Error in integral2 (line 105)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
Thank you Torsten! I have added that "r0 is a known constant."
Thank you Dyuman Joshi! I have added my tries, and i also have the Symbolic Math Toolbox.

Sign in to comment.

 Accepted Answer

Setting l, r and s to zero will cause problems because you divide by these variables.
But also changing
integral2(@(s,l)arrayfun(@(s,l)fun(s,l),s,l),0,Inf,0,r0)
to
integral2(@(s,l)arrayfun(@(s,l)fun(s,l),s,l),1e-4,Inf,1e-4,r0)
does not help.
Thus try to check theoretically whether your integral exists at all.
r0 = 100;
fun_inner = @(s,l)integral(@(r)1./(1+s./r.^2).^2.*r,l,r0)
fun_inner = function_handle with value:
@(s,l)integral(@(r)1./(1+s./r.^2).^2.*r,l,r0)
fun = @(s,l)exp(-s)./s .*exp(fun_inner(s,l)).* 1./(1+s./l.^2)
fun = function_handle with value:
@(s,l)exp(-s)./s.*exp(fun_inner(s,l)).*1./(1+s./l.^2)
value = integral2(@(s,l)arrayfun(@(s,l)fun(s,l),s,l),0,Inf,0,r0)
Warning: Inf or NaN value encountered.
Warning: The integration was unsuccessful.
value = NaN

More Answers (0)

Asked:

on 11 Apr 2024

Commented:

on 11 Apr 2024

Community Treasure Hunt

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

Start Hunting!