# HG changeset patch # User Marco Caliari # Date 1302627373 25200 # Node ID 68eb9713b55037f7de4675015e677a1bd8f5b6bf # Parent 47417d37c4db1cfb0c3f510cb6e62169e3315cc2 quadgk.m: Fix problem with -Inf bound on integral (bug #33055). diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2011-04-12 Marco Caliari + + * general/quadgk.m: Fix problem with -Inf bound on integral (bug + #33055). + 2011-04-11 Ben Abbott * miscellaneous/getappdata.m: If appdata propery does not exist, return diff --git a/scripts/general/quadgk.m b/scripts/general/quadgk.m --- a/scripts/general/quadgk.m +++ b/scripts/general/quadgk.m @@ -223,9 +223,9 @@ if (!isempty (waypoints)) tmp = sqrt (b - waypoints); trans = @(x) - x ./ (x + 1); - subs = [0; trans(tmp); 1]; + subs = [-1; trans(tmp); 0]; else - subs = linspace (0, 1, 11)'; + subs = linspace (-1, 0, 11)'; endif h = 1; h0 = b - a; @@ -449,3 +449,4 @@ %!assert (quadgk (@(z) log (z), 1+1i, 1+1i, 'WayPoints', [1-1i, -1,-1i, -1+1i]), -pi * 1i, 1e-6) %!assert (quadgk (@(x) exp(-x .^ 2), -Inf, Inf), sqrt(pi), 1e-6) +%!assert (quadgk (@(x) exp(-x .^ 2), -Inf, 0), sqrt(pi)/2, 1e-6)