octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #37896] quadcc(f, -Inf, Inf) incorrectly retur


From: Drew Parsons
Subject: [Octave-bug-tracker] [bug #37896] quadcc(f, -Inf, Inf) incorrectly returns 0 (quadgk too)
Date: Tue, 11 Dec 2012 01:04:36 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20100101 Firefox/10.0.11 Iceweasel/10.0.11

URL:
  <http://savannah.gnu.org/bugs/?37896>

                 Summary: quadcc(f,-Inf,Inf) incorrectly returns 0 (quadgk
too)
                 Project: GNU Octave
            Submitted by: dparsons
            Submitted on: Tue 11 Dec 2012 01:04:34 AM GMT
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Drew Parsons
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I'm using quadcc (and comparing with quadgk) for an integral which in general
has infinite bounds.

The function is
f = @(x) exp (-x .^ 2 / (2 * 500 ^ 2)) / (sqrt (2 * pi) * 500) .* (150e5 / 2)
.* (22 - x) .^ 2 ./ (50 - (22 - x)) .* heaviside (-(22 - x), 1)
(the real coefficients and the Heaviside function relate to the physics that
I'm modelling)

It has a large, finite value, which I can estimate with
> lim=1e5; quadcc ( f, -lim, lim, 1e-5 )
ans =  1.2703e+09

But with any larger limit (including Inf), quadcc returns 0:
> lim=1e6; quadcc ( f, -lim, lim, 1e-5 )
ans = 0
> lim=Inf; quadcc ( f, -lim, lim, 1e-5 )
ans = 0



quadgk is also misbehaving at large limits. I get the same solution (with some
small error) at a limiting finite bound,
> lim=1e5; quadgk ( f, -lim, lim, 1e-5 )
warning: quadgk: maximum interval count (650) met
warning: quadgk: Error tolerance not met. Estimated error 0.000776351
ans =  1.2703e+09
> lim=1e6; quadgk ( f, -lim, lim, 1e-5 )
warning: quadgk: maximum interval count (650) met
warning: quadgk: Error tolerance not met. Estimated error 0.171285
ans =  1.2703e+09

but "mostly zero" at larger finite limits,
> lim=1e7; quadgk ( f, -lim, lim, 1e-5 )
ans =  5.4000e-131

But then at Inf, quadgk gives a finite value, meeting the correct value within
gross error bars,
> lim=Inf; quadgk ( f, -lim, lim, 1e-5 )
warning: quadgk: Error tolerance not met. Estimated error 2.41746e+09
ans =  2.4847e+09


This quadgk behaviour is curious, but I understand quadgk is expected to come
with greater error.  I'm mainly filing this bug to address the misbehaviour in
quadcc.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37896>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]