[SciPy-User] scipy.interpolate.KroghInterpolator: output confusion.

Marco Nicoletti nicoletti at consorzio-innova.it
Fri Oct 16 02:58:57 EDT 2009


Dear all,

I have found something that loks like a bug (or at least a confusing staff) in the output of KroghIntepolator class.

The problem is the following:

case 1
from scipy import interpolate
import numpy as np
xi = [2, 3, 4]
yi = [10,13,15]
yi_der = [1, 2, 2.5]
Y = np.asarray([yi, yi_der]).transpose()
krogh = interpolate.KroghInterpolator(xi, Y)
print krogh(2.3)
>> [ 11.005    1.3525]
Evaluating one point 2.3, it returns a 1-D array with array([value, derivative value]). 

case 2
from scipy import interpolate
import numpy as np
xi = [2, 3, 4]
yi = [10,13,15]
krogh = interpolate.KroghInterpolator(xi, yi)
print krogh([2.3, 4.5])
>> [ 11.005  15.625]
Evaluating points [2.3, 4.5], it returns a 1-D array with array([value for 2.3, value for 4.5]). 
You cannot distinguish the two cases.
In my opinion case 1 should return a 2-D array as follows array([[value, derivative value]]);
instead case 2 should return a 2-D array as follows array([[value for 2.3], [value for 4.5]]). 

what do you think? confusing?

Marco Nicoletti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20091016/9e0bc422/attachment.html>


More information about the SciPy-User mailing list