It appears that splint doesn't work correctly when asked to integrate
a region outside the support of the original function. Consider the following code: """ from scipy import interpolate from scipy.integrate import quad y = array([ 0.38608245, 0.33937334, 0.30557594, 0.29031793, 0.27597413, 0.26680583, 0.25012443, 0.24310048, 0.23825924, 0.23260759, 0.22179233, 0.21821583, 0.2164903 , 0.21275566, 0.20813042, 0.20404953, 0.19703265, 0.19649831, 0.19548709, 0.1922062 , 0.18623453]) # x = ones(y.size)/4 x[0] /= 2 x = x.cumsum() tck = interpolate.splrep(x, y, s=0.0001) """ splev appears to have no problems extrapolating outside the original support: print interpolate.splev(0, tck, der=0) 0.412282701045 print interpolate.splev(0.1, tck, der=0) 0.389777686302 print interpolate.splev(0.2, tck, der=0) 0.369853064862 however in the first two cases below the results from splint appear a little suspect: print interpolate.splint(0, 0.1, tck) -0.0096789147401 print interpolate.splint(0, 0.2, tck) 0.0282819198434 print interpolate.splint(0.2, 0.3, tck) 0.0360893890763 and indeed, comparing against quad only the final result where the bounds are wholly within the original support do they agree: print quad(lambda v: interpolate.splev(v, tck, der=0), 0, 0.1)[0] 0.040080715787 print quad(lambda v: interpolate.splev(v, tck, der=0), 0, 0.2)[0] 0.0780415503705 print quad(lambda v: interpolate.splev(v, tck, der=0), 0.2, 0.3)[0] 0.0360893890763 Is this a bug in splint or expected behaviour when the bounds are outside the original support (even though splev has no problems) or am I simply mis- understanding something obvious? Thanks, Dave _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Dave Hirschfeld <dave.hirschfeld <at> gmail.com> writes:
> > It appears that splint doesn't work correctly when asked to integrate > a region outside the support of the original function. > I've created a ticket for this issue so that it doesn't get lost: http://projects.scipy.org/scipy/ticket/1393 If it turn out to be expected behaviour it can always be closed. Regards, Dave _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On Thu, Feb 24, 2011 at 4:02 AM, Dave Hirschfeld <[hidden email]> wrote:
Dave Hirschfeld <dave.hirschfeld <at> gmail.com> writes: Thanks Dave. Warren _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |