Double integral of a function (Beginners Question)
Subject: Double integral of a function (Beginners Question)
From: Doktor Bernd
Date: Mon, 7 Jun 2010 20:59:17 +0000
>Since there are a lot of floats in the integrand, I'm guessing
>an approximate result is OK. Instead of
Yes, an approximation is fine.
>> integrate(integrand(kappa,Cn2,(1-xi)/L,L,Lambda,Theta_inv,xi,k,r),kappa,0,inf);
>> integrate(%,xi,0,1);
>> float(%);
>
>try this:
>
>I : integrand(kappa,Cn2,(1-xi)/L,L,Lambda,Theta_inv,xi,k,r);
>I1 : quad_qags (I, xi, 0, 1)[1];
>I2 : quad_qagi (I1, kappa, 0, inf);
>
> => [3.93347674966401e-20, 9.416575845421898e-22, 3225, 5]
Great, I was still waiting for my accurate result (>6 hours), so I guess an approximation is the only practicable way for me.
I used the QUADPACK functions before, but did not succeed. I was missing [1] in I1. Argh, now I know.
>The integrand is very nearly zero almost everywhere,
>which might make it more difficult for the quadrature functions
>to estimate the error. Maybe you can rescale the integrand.
Defenitely a good idea.
>Note that I2 doesn't take into account any error estimate from I1.
>Iterated quadrature is probably not such a great method,
>although Monte Carlo and quasi-Monte Carlo are probably less
>efficient (i.e. need more function evaluations for the same
>accuracy) than iterated quadrature for a 2-d problem.
>Maybe there are better methods especially for low-dimensional
>integration.
I see, there is still a lot of documentation left for me to read.
>plot3d (I, [kappa, 0.1, 1], [xi, 0, 1], [grid, 50, 50]);
>seems to be informative.
Thanks for this hint, plotting would have been my next question.
>By the way, what is the origin of this problem?
I am trying to calculate the scintillation index of a laser beam propagating through the atmosphere.
spec is the atmospheric spectrum and because its influence on the beam changes with propagation distance
I have to do the double integration along frequency kappa and normalized propagation distance xi.
Thank you very very much,
Bernd
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969