"Steven_Lord" <firstname.lastname@example.org> wrote in message <email@example.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 two-dimensional 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
where h = 3, k = 4, a = 5, and b = 6.25 . Particularly if r is transformed to u = sqrt(a^2-r^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^2-h^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
This is a very well-behaved 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 bell-shaped 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 one-dimensional 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.