Double integral of a function (Beginners Question)




On Mon, 7 Jun 2010, Doktor Bernd wrote:

< >
< > 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.
< 
< If I remove the double parantheses and split up the function call as suggested, I get the same error.
< The problem was that I reused l as integration variable in roh_0, but it was declared in the caller of integrand .
< 
< I fixed it and now maxima is doing something.
< 
< Is there a way to check what maxima is doing? Or get an estimate on how long the programm will run?
< 
< I use wxMaxima and often have the problem that nothing happens for a long time, when I then click the interrupt current computation button, it shows me that Maxima
< was stuck at a syntax error. Now it runs for two hours and I am a little bit worried that it got stuck again.
< 
< My code is now:
< 
< 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,l],(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))) $
< assume(xi >= 0, xi <= 1);
< integrate(integrand(kappa,Cn2,(1-xi)/L,L,Lambda,Theta_inv,xi,k,r),kappa,0,inf);
< integrate(%,xi,0,1);
< float(%);
 
This code has a couple syntax errors in it.
Try running Maxima in a terminal window.

Leo

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