| 1 | initial version |
For mapping one real interval to another interval, you have the numpy function interp() (linear approximation).
Example :
import numpy as np
from numpy import interp
prec = 200
xp = np.linspace(0.0, 99.0, prec)
yp = np.linspace(-1.0, 1.0, prec)
print interp([52.0],xp,yp)
The printed value is near 0.0 (middle of interval [-1,1]) because 52.0 is near 50.0 (middle of interval [0,99])
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.