Memory error with quadratic interpolation

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Jan 24 11:30:55 CET 2013


On 23 January 2013 17:33, Isaac Won <winefrog at gmail.com> wrote:
> On Wednesday, January 23, 2013 10:51:43 AM UTC-6, Oscar Benjamin wrote:
>> On 23 January 2013 14:57, Isaac Won <winefrog at gmail.com> wrote:
>>
>> > On Wednesday, January 23, 2013 8:40:54 AM UTC-6, Oscar Benjamin wrote:
>>
>> Unless I've misunderstood how this function is supposed to be used, it
>> just doesn't really seem to work for arrays of much more than a few
>> hundred elements.
>>

The solution is to use UnivariateSpline. I don't know what the
difference is but it works where the other fails:

import numpy as np
from scipy.interpolate import UnivariateSpline
x = np.array(10000 * [0.0], float)
indices = np.arange(len(x))
interp = UnivariateSpline(indices, x, k=2)
print(interp(1.5))


Oscar



More information about the Python-list mailing list