From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Double integration
Date: Wed, 27 Apr 2011 23:25:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <ipa8kk$ovd$>
References: <ipa14h$quv$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1303946708 25581 (27 Apr 2011 23:25:08 GMT)
NNTP-Posting-Date: Wed, 27 Apr 2011 23:25:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:724169

"bob bobby" wrote in message <ipa14h$quv$>...
> ......
> I have tried to use the following 
> quad2d(@(x,s) normpdf(s).*normpdf(x).*(s+x-1), @(s) 1-s, 500, -500, 500);
> ......
- - - - - - - - - 
  One more thought.  The values you have used in place of plus and minus infinity are very likely much too large and could create difficulties in the integration process.  Setting x or s equal to plus or minus 500 produces exp(-125000) which would be an exact zero for matlab floating point numbers.  In fact for a very large part of the range of integration you would have a zero integrand.  This can cause 'quad2d' to accidentally skip over the range where the integrand has significantly sizable values, or to not sample the integrand with sufficiently fine intervals where it is important for an accurate answer.  Try using much, much smaller limits in place of those 500's.  There's no reason at all to go out that far.

Roger Stafford