Bug in quadgk on an infinite domain

Marco Caliari marco.caliari at univr.it
Tue Jun 9 07:30:52 CDT 2009


Dear maintainers,

there is a bug in the 'Standard Infinite to finite integral 
transformation' in quadgk.m (3.2.0). The correct transformation is

##   g(t)  = t / (1 - t^2)
##   g'(t) =  (1 + t^2) / (1 - t^2) ^ 2

With the enclosed patch, I get

octave:1> quadgk(@(x)exp(-x.^2),-10,10)
ans =  1.77245385090546e+00
octave:2> quadgk(@(x)exp(-x.^2),-Inf,Inf)
ans =  1.77245385078031e+00

that is sqrt(pi)

octave:3> sqrt(pi)
ans =  1.77245385090552e+00

whereas, with the original quadgk, I get

octave:4> quadgk(@(x)exp(-x.^2),-Inf,Inf)
ans =  1.15710256465273e+00

Best regards,

Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quadgk.diff
Type: text/x-diff
Size: 876 bytes
Desc: 
Url : https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20090609/682bdab5/attachment.bin 


More information about the Bug-octave mailing list