Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

scipy interpolate in sage

Hi there,

I am trying to interpolate a 1D function in sage using scipy.interpolate.interp1d(). I have an array of X values and an array of Y values. I generate the interpolation function like:

f = scipy.interpolation.interp1d(x, y, kind='cubic')

So far so good. Now, when I try to calculate the value of the function at a given value:

f(1.0)

I get the following error:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_2.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("c2lsaWNvbl9yZWFsKDIwMC4wKQ=="),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>

File "/tmp/tmpEKr8Bl/___code___.py", line 3, in <module> exec compile(u'silicon_real(_sage_const_200p0 ) File "", line 1, in <module>

NameError: name 'f' is not defined

click to hide/show revision 2
retagged

scipy interpolate in sage

Hi there,

I am trying to interpolate a 1D function in sage using scipy.interpolate.interp1d(). I have an array of X values and an array of Y values. I generate the interpolation function like:

f = scipy.interpolation.interp1d(x, y, kind='cubic')

So far so good. Now, when I try to calculate the value of the function at a given value:

f(1.0)

I get the following error:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_2.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("c2lsaWNvbl9yZWFsKDIwMC4wKQ=="),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module>

File "/tmp/tmpEKr8Bl/___code___.py", line 3, in <module> exec compile(u'silicon_real(_sage_const_200p0 ) File "", line 1, in <module>

NameError: name 'f' is not defined