ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 01 Jan 2018 14:03:14 +0100Mixing %cython and @interact in one cellhttps://ask.sagemath.org/question/40417/mixing-cython-and-interact-in-one-cell/I'm trying to make an interactive applet to visualize the Mandelbrot Set, much in the way of the implementation of interactive fractals (wiki.sagemath.org/interact/fractal#Exploring_Mandelbrot - cannot copy full link because of not enough karma ;-))
But I'd like to embed the applet in a webpage using SageMathCell, and for this all the code must be encapsulated in just one cell, something in the following scheme
%cython
def function(...)
...
@interact
...
Unfortunately, `%cython` and `@interact` behave badly together, because the latter is unknown to the former (just try to join the code in the two cells of the example above or try the following minimal working example
%cython
def square(float x0):
return x0*x0
@interact
def _(x0=-2.5):
print(square(x0))
which, surprisingly enough, raises different errors in a online Sage Cell and in a Sage Notebook Cell)
Which would be the smartest way to mix everything up? Any suggestion is highly appreciated.jepstraMon, 01 Jan 2018 14:03:14 +0100https://ask.sagemath.org/question/40417/How to enable %cython magic function in sage terminal mode?https://ask.sagemath.org/question/7610/how-to-enable-cython-magic-function-in-sage-terminal-mode/In the notebook mode of sage there are a full list of available magic functions, like %cython, that doesn't exist in the terminal (or iphyton interface?)
My goal is to enable %cython within the Sage command line mode, how can i do that?
ngativSun, 22 Aug 2010 07:54:36 +0200https://ask.sagemath.org/question/7610/