changeset 12595:68eb9713b550 stable

quadgk.m: Fix problem with -Inf bound on integral (bug #33055).
author Marco Caliari <marco.caliari@univr.it>
date Tue, 12 Apr 2011 09:56:13 -0700
parents 47417d37c4db
children 5161d02c96b7
files scripts/ChangeLog scripts/general/quadgk.m
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Apr 12 01:28:31 2011 -0500
+++ b/scripts/ChangeLog	Tue Apr 12 09:56:13 2011 -0700
@@ -1,3 +1,8 @@
+2011-04-12  Marco Caliari  <marco.caliari@univr.it>
+
+	* general/quadgk.m: Fix problem with -Inf bound on integral (bug
+	#33055). 
+
 2011-04-11  Ben Abbott  <bpabbott@mac.com>
 
 	* miscellaneous/getappdata.m: If appdata propery does not exist, return
--- a/scripts/general/quadgk.m	Tue Apr 12 01:28:31 2011 -0500
+++ b/scripts/general/quadgk.m	Tue Apr 12 09:56:13 2011 -0700
@@ -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)