
Re: Double integration
Posted:
Dec 6, 2011 12:42 PM


"Steven_Lord" <slord@mathworks.com> wrote in message <jbhhc3$bau$1@newscl01ah.mathworks.com>... > http://www.mathworks.com/help/techdoc/ref/quad2d.html         Hi Marcio and Steve. In the case of that particular double integral I suggest that, rather than doing a fully twodimensional numerical integration with 'quad2d', it may be preferable to transform to polar coordinates and take advantage of the fact that the resulting inner integrand now has a known analytic solution, so the problem can be reduced to a single numerical integration.
With the change to polar coordinates, x = r*cos(t), y = r*sin(t), the problem assumes the form
int(int('k*sqrt(b^2r^2)/sqrt(a^2r^2)*r','r',h*sec(t),a),'t',0,asec(a/h))
where h = 3, k = 4, a = 5, and b = 6.25 . Particularly if r is transformed to u = sqrt(a^2r^2), a symbolic solution can readily be determined for this inner integrand. When evaluated at the two limits of integration the resulting function, though no longer approaching infinity at the upper limit, nevertheless still possesses an infinite derivative as t approaches asec(a/h), something that may disturb a numerical integration procedure. The transformation sin(v) = h/sqrt(a^2h^2)*tan(t) remedies that also.
The final result of all this is a single integral from v = 0 to v = pi/2 of the function
f(v) = k*h*sqrt(a^2h^2)/2*cos(v)./(a^2(a^2h^2)*cos(v).^2) .* ... (sqrt(a^2h^2)*cos(v).*sqrt(b^2a^2+(a^2h^2)*cos(v).^2) ... + (b^2a^2)*asinh(sqrt(a^2h^2)/sqrt(b^2a^2)*cos(v)));
This is a very wellbehaved curve without singularities or infinite slopes. In fact if plotted all the way from v = pi/2 to +pi/2 it looks remarkably like a gaussian bellshaped curve. On my system the integral yields an answer of 53.57353374498558 when the tolerance is set to a tight value.
The advantage this procedure has over a double numerical integration is presumably that far fewer points need be evaluated in the onedimensional case, and there is no difficulty with the singularity that occurs all the way along the circular boundary. On the other hand, there is admittedly more work for the user to do in the necessary algebra involved in performing these transformations.
Roger Stafford

