Dear all,

I'm sorry if this is a 'utfs' question, but I couldn't really find a
clear answer. I would like to do some numerical operations on a Sage
function (/expression) provided by the user (i.e. typed in the
notebook). Ideally I would like to have this function available as a
Cython function to perform these operations (assuming say the input is
a composition of only 'elementary' functions). So say the user enters
'f(x)=x^2' I would like to have a Cython function like

cdef f_ cython(double x):
   return x**2

so that I can run other Cython functions that evaluate f_cython (a
lot). Is there a standard way to do something like this? If not, I
guess I could try producing the code for the Cython function
definition as a string and then call eval(...) on it or something like
that? What would be the best way, keeping an eye on optimisation for
speed?

Many thanks, Kees

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to