From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Evaluate double integral
Date: Tue, 17 Aug 2010 19:02:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <i4embd$kqk$>
References: <i4e2ns$pak$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1282071725 21332 (17 Aug 2010 19:02:05 GMT)
NNTP-Posting-Date: Tue, 17 Aug 2010 19:02:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:662803

"Paul " <> wrote in message <i4e2ns$pak$>...
> Hello.
> I have two integrals (S is integral):
>  I(t)=S(f(x,t))dx
>  B(t)=S(g(x,t))dx
> function dblquad is used to find integral SS(f(x,t)*g(x,t))dxdt
> But is there exist some way to find the following integral:
> S(I(t)*B(t))dt
> May be some numerical methods. 
> Please help, I just don't know how to do it.
> Thanks in advance.
- - - - - - - - -
  The easy way to do it is to consider it a triple integration problem.  Matlab's 'triplequad' could handle it provided a three-dimensional rectangular volume is involved.  The integrand would simply be f(x,t)*g(y,t), integrated with respect to x, y, and t.  The x and y would range over the values you use for defining I(t) and B(t) and the t would range over the values you have for the final integral.

  On the other hand you could conceivably treat it as a double integration problem by defining the functions I(t) and B(t) in terms of results obtained from separate uses of one of the quadrature functions.  Then you could prepare another function that would multiply these two values together to be used as an integrand in a second quadrature.  The difficulty there would be that with matlab's quadrature routines this second quadrature function will be passing vectors, not scalars, to its integrand function.  Since your integrand function has to do two integrations for each value in such a vector, you would have to provide your integrand function with this capability - meaning that there has to be a testing of the length of the vector passed to it and a for-loop with the corresponding count used to obtain the multiple integrand values.

  You can count on the latter being a slow process.  However triple integration is not fast either and it might possibly be much slower than doing the more cumbersome double integration.

Roger Stafford