Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Double integration
Date: Fri, 2 Dec 2011 22:29:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <jbbjfk$kkn$1@newscl01ah.mathworks.com>
References: <jb8gd0$52k$1@newscl01ah.mathworks.com> <jb9f96$ed2$1@newscl01ah.mathworks.com> <jbb6bl$6af$1@newscl01ah.mathworks.com> <jbbaet$jsd$1@newscl01ah.mathworks.com> <jbbd71$af$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1322864948 21143 172.30.248.48 (2 Dec 2011 22:29:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 2 Dec 2011 22:29:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:751294

"Marcio Barbalho" <marciobarbalho@live.com> wrote in message <jbbd71$af$1@newscl01ah.mathworks.com>...
> I have abso-bloody-lutely nothing against numerial integration. In actuality, I love numerical methods, of course, that does not mean I am an expert. I am just a junior engineer who loves maths and eventually find it interesting to play with calculus on rainy weekends.
> 
> Alright... my question is... how do I solve the inner integral numerically if the upper limit is not a number but an expression? I tried with the substitutions you proposed it pushed me to the drawing board, meaning it hit some point that neither mupad nor maple could go any further.
> 
> Thank you
- - - - - - - - - -
  OK, do you agree with me that changing to polar coordinates gives you this equivalent double integral:

 int (0,asec(5/3)) int (3*sec(t),5) sqrt((625-16*r^2)/(25-r^2))*r dr dt ?

I'm not certain but I don't believe Mupad or Maple can do that for you.  It takes a little calculus on your part.

  However, I strongly suspect that Maple can obtain a formula in terms of t for that inner integral taken with respect to r:

 int (3*sec(t),5) sqrt((625-16*r^2)/(25-r^2))*r dr

If I can do it using the substitution u = sqrt(25-r^2) as I showed you earlier, presumably Maple can also do it with some trick or other.  If not, here is the basic form out of my integral table that will allow you to solve that indefinite integral in terms of u I mentioned:

 int sqrt(a^2+z^2) dz = 1/2*z*sqrt(a^2+z^2)+1/2*a^2*log(z+sqrt(a^2+z^2))

From that you can derive a solution to the above inner definite integral.  Either way, this inner integral does not require numerical integration.  The result is a specific formula in terms of t for the inner integral.

  Using the resulting formula for the inner definite integral as a function of t, you can then use one of matlab's numerical quadrature functions, 'quad', 'quadgk', or 'quadl', to do a single numerical (outer) integration with respect to t using the inner integral expression as an integrand between the two limits t=0 and t=asec(5/3).  You do need to do a little study on these routines to be able to set up the desired error tolerances, etc.

  As I mentioned earlier there should be no trouble with singularities if you proceed along the above lines.  On the other hand, if you were to integrate with respect to t first and then with respect to r afterwards, I believe you would have trouble with a singularity at r = 5, so it is advisable to integrate with respect to r first.

  Does all that make sense?  If not, just ask for further help.

Roger Stafford