bugGNU Octave - Bugs: bug #33055, Serious problem with quadgk with...

 
 

bug #33055: Serious problem with quadgk with exp(-s.^2) from -Inf to 0

Submitted by:  M. Badawy <firstharmonic>
Submitted on:  Tue 12 Apr 2011 07:05:01 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.2.4Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 12 Apr 2011 05:07:08 PM UTC, comment #2:

Applied Marco's patch and verified fix. You will need to build from the Mercurial sources (or patch your own sources) in order to see this fix. Instructions for downloading sources are at http://www.gnu.org/software/octave/download.html

Rik <rik5>
Project Administrator
Tue 12 Apr 2011 07:54:08 AM UTC, comment #1:

The problem is in the integral interval after the changes of variables. The enclosed patch fixes the problem.

Marco

(file #23210)

Marco Caliari <caliari>
Project Member
Tue 12 Apr 2011 07:05:01 AM UTC, original submission:

I got the following from the terminal:

>>> quadgk(@(s) exp(-s.^2), -Inf, 0)

ans = -0.24489

First, this is a positive function, so the answer can't be negative.

Second, the answer should be equal to: sqrt(pi)/2 = 0.88623.

Despite this problem, Octave gets the right answer for:

>>> quadgk(@(s) exp(-s.^2), -Inf, Inf)

ans = 1.7725 ( = sqrt(pi))

and

>>> quadgk(@(s) exp(-s.^2), 0, Inf)

ans = 0.88623 ( = sqrt(pi)/2)

In my research, I encountered the same problem when using quadgk with an even integrand integrating from -Inf to 0.

Hope this helps.

M. Badawy <firstharmonic>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #23210:  quadgk.m.diff added by caliari (724B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by caliari (Updated the item)
  • -unavailable- added by firstharmonic (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 12 Apr 2011 05:07:08 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Tue 12 Apr 2011 07:54:08 AM UTCcaliariAttached File-=>Added quadgk.m.diff, #23210

    Back to the top


    Powered by Savane 3.1-cleanup1