Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Double integration
Replies: 10   Last Post: Dec 6, 2011 12:42 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roger Stafford

Posts: 5,816
Registered: 12/7/04
Re: Double integration
Posted: Dec 6, 2011 12:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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 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

int(int('k*sqrt(b^2-r^2)/sqrt(a^2-r^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^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

f(v) = k*h*sqrt(a^2-h^2)/2*cos(v)./(a^2-(a^2-h^2)*cos(v).^2) .* ...
(sqrt(a^2-h^2)*cos(v).*sqrt(b^2-a^2+(a^2-h^2)*cos(v).^2) ...
+ (b^2-a^2)*asinh(sqrt(a^2-h^2)/sqrt(b^2-a^2)*cos(v)));

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.

Roger Stafford



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.