Closed shizejin closed 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 .
@albop Just FYI, @shizejin is helping to hook up the interpolations library to the QuantEcon lectures.
@shizejin and @jstac Cool! @shizejin: I think I fixed it in the PR #30. Here is what was happening:
(i, λ)
where i
is the index of the cell to interpolate and λ
a barycentric coordinate in that celli
was not restricted to lie within the acceptable range which contains only one value in your example (0,)
so there was an out of bounds error and a random picked value was picked. For some reason on my machine it is a finite one so I didn't notice. Wasn't so finite on yours.i
inside the admissible range (see i = clamp(i, 0, N-2)
in https://github.com/EconForge/interpolation.py/pull/30/commits/1294d63e4b035d3b1a7a29e493c2aa83cd255289) . When extrapolation happens then the barycentric is not contained in [0,1] anymore, but that is ok. Thank you for your quick response @albop ! interp
is now working correctly in the lecture notebook.