Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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?

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?