# Revision history [back]

### Importing Sage functions into Cython?

I am playing around with Cython but I can't get it to work very well with Sage. As a very simple example of the problems I am having, the following code doesn't work. I know that the reason is that I need to import numerical_integral() from Sage somehow, but I don't know exactly how to do that.

%cython

numerical_integral(x^2, 0,1)


(This is something that's been confusing me for a few days now. I'm not sure if there's something about how Cython is supposed to be used that I am not understanding properly.)

### Importing Sage functions into Cython?

I am playing around with Cython but I can't get it to work very well with Sage. As a very simple example of the problems I am having, the following code doesn't work. I know that the reason is that I need to import numerical_integral() from Sage somehow, but I don't know exactly how to do that.

%cython

numerical_integral(x^2, 0,1)


(This is something that's been confusing me for a few days now. I'm not sure if there's something about how Cython is supposed to be used that I am not understanding properly.)

EDIT: after trying out some things, I realized that sage.gsl.integration.numerical_integral() has the same effect as numerical_integral() in Sage. So, somehow, I should import the function from sage.gsl.integration, if that even makes any sense?

 3 retagged slelievre 16954 ●21 ●150 ●335 http://carva.org/samue...

### Importing Sage functions into Cython?

I am playing around with Cython but I can't get it to work very well with Sage. As a very simple example of the problems I am having, the following code doesn't work. I know that the reason is that I need to import numerical_integral() from Sage somehow, but I don't know exactly how to do that.

%cython

numerical_integral(x^2, 0,1)


(This is something that's been confusing me for a few days now. I'm not sure if there's something about how Cython is supposed to be used that I am not understanding properly.)

EDIT: after trying out some things, I realized that sage.gsl.integration.numerical_integral() has the same effect as numerical_integral() in Sage. So, somehow, I should import the function from sage.gsl.integration, if that even makes any sense?