Double integral of a function (Beginners Question)




On Mon, 7 Jun 2010, Doktor Bernd wrote:

< 
< Thank you for your help!
< 
< If I got it right, I could remove the block stuff, but it should not nurt having them
< So I leave it as it is for now.
< 
< For the second Problem, I am back where I started.
< When I remove all qotes, I get:
< 
< (%i20) Lambda : 0 $
< Theta : 1 $
< Theta_inv : 1-Theta $
< W_0 : 0.0254 $
< L : 50000 $
< Cn2 : 1e-17 $
< li : 0.005 $
< lo : 5.0 $
< k : 7.139983303613165e+006 $
< r : 0 $
< Cn2(l) := block([l:l], 1e-17) $
< rho_0(k,L,Cn2) := block([k:k,L:L,Cn2:Cn2],(1.46*k^2*integrate(Cn2(l),l,0,L))^(-3/5)) $
< ka2x(k,l,Cn2) := block([k:k,l:l,Cn2:Cn2],(0.38/k + 0.35*(l/(k*rho_0(k,l,Cn2)))^2)^-1) $
< ka2y(k,l,Cn2) := block([k:k,l:l,Cn2:Cn2],3*k/l + 1.7/rho_0(k,l,Cn2)) $
< f(kappa,li):= block([kappa:kappa,li:li],exp(-kappa^2/(3.3/li)^2)*(1+1.803*(kappa/(3.3/li))-0.254*(kappa/(3.3/li))^(7/6))) $
< g(kappa,lo):= block([kappa:kappa,lo:lo],(1-exp(-kappa^2/(8*%pi/lo)^2))) $
< spec(Cn2,kappa,ka2x,ka2y,li,lo):= block([Cn2:Cn2,kappa:kappa,ka2x:ka2x,ka2y:ka2y,li:li,lo:lo],0.033*Cn2*kappa^(-11/3)* f(kappa,li) * g(kappa,lo) *exp(-(kappa^2)/(ka2x))+(kappa^(11/3))/(kappa^2+ka2y^2)^(11/6)) $
< integrand(kappa,Cn2,l,L,Lambda,Theta_inv,xi,k,r):= block([kappa:kappa,Cn2:Cn2,l:l,L:L,Lambda:Lambda,Theta_inv:Theta_inv,xi:xi,k:k,r:r],kappa*spec(Cn2,kappa,ka2x(k,l,Cn2),ka2y(k,l,Cn2),li,lo)*exp(-(Lambda*L*kappa^2*xi^2)/(k)) *
< (bessel_i(0,2*Lambda*r*kappa*xi)-cos((L*kappa^2)/k)*xi*(1-Theta_inv*xi))) $
< float(integrate((integrate((integrand(kappa,Cn2,(1-xi)/L,L,Lambda,Theta_inv,xi,k,r)),kappa,0,inf)),xi,0,1));
< 
< defint: variable of integration must be a simple or subscripted variable.
< defint: found (1-xi)/50000
< #0: rho_0(k=7139983.303613165,l=(1-xi)/50000,cn2=1.0000000000000001E-17)
< #1: ka2x(k=7139983.303613165,l=(1-xi)/50000,cn2=1.0000000000000001E-17)
< #2: integrand(kappa=kappa,cn2=1.0000000000000001E-17,l=(1-xi)/50000,l=50000,lambda=0,theta_inv=0,xi=xi,k=7139983.303613165,r=0)
< ?-- an error. To debug this try: debugmode(true);
< 
< I thought this error is due to the evaluation of the parameters as they are passed to the functions. So the quotes should deferre the evaluation of the expressions until the last statement.
< What is the correct way to evaluate the double integral?
 
Try:

integrate(foo,kappa,0,inf);
integrate(%,xi,0,1);
float(%);

I think your use of double parentheses is causing the error. In any
event, breaking the multi-integral into steps will clarify where the
error is occuring.

Leo
-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.