If I understand well, then what you want is simple interpolation. For this, you can use scipy.interpolate( http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html ):
from scipy.interpolate import interp1d
f = interp1d(x, y)
f2 = interp1d(x, y, kind='cubic')
xnew = np.linspace(x.min(), x.max(), num=41, endpoint=False)
ynew = f(xnew)
You can create a function that returns the coordinates of the divided points specified x, yand the number of desired points:
def split_curve(x, y, npts):
from scipy.interpolate import interp1d
f = interp1d(x, y)
xnew = np.linspace(x.min(), x.max(), num=npts, endpoint=False)
ynew = f(xnew)
return zip(xnew[1:], ynew[1:])
For instance,
split_curve(np.array([0, 1]), np.array([0, 1]), 2) ## returns [(0.5, 0.5)]
split_curve(np.array([0, 1]), np.array([0, 1]), 3) ## [(0.33333333333333331, 0.33333333333333331), (0.66666666666666663, 0.66666666666666663)]
Note that x and y are numpy arrays, not lists.