EconForge / interpolation.py

BSD 2-Clause "Simplified" License
123 stars 35 forks source link

`interp` returns strange value when `x` is outside the grid range #29

Closed shizejin closed 5 years ago

shizejin commented 5 years ago
>>> from interpolation import interp
>>> import numpy as np
>>> x = np.array([0., 1.])
>>> y = np.array([1., 2.])
>>> interp(x, y, 0.5)
1.5
>>> interp(x, y, 1.5)
-1.5555469624081107e+231
>>> interp(x, y, 2.)
-3.1110939248162215e+231
albop commented 5 years ago

Yeah, that's a lot...

Le dim. 23 sept. 2018 à 06:46, Zejin Shi notifications@github.com a écrit :

from interpolation import interp>>> import numpy as np>>> x = np.array([0., 1.])>>> y = np.array([1., 2.])>>> interp(x, y, 0.5)1.5>>> interp(x, y, 1.5)-1.5555469624081107e+231>>> interp(x, y, 2.)-3.1110939248162215e+231

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EconForge/interpolation.py/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQ5KddLnp_yx7jCBeL0is3rcMFANFalks5udxJBgaJpZM4W1js1 .

jstac commented 5 years ago

@albop Just FYI, @shizejin is helping to hook up the interpolations library to the QuantEcon lectures.

albop commented 5 years ago

@shizejin and @jstac Cool! @shizejin: I think I fixed it in the PR #30. Here is what was happening:

shizejin commented 5 years ago

Thank you for your quick response @albop ! interp is now working correctly in the lecture notebook.