Hi,
the Interact command does not seem to be working in Sage 7.3 Jupyer
Notebook!
Here is the code from a notebook cell:
-----------------------------------------------------------------
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
def plotNthRoots(n):
# Create a unit circle
c = circle((0,0), radius=1, rgbcolor=(1,0,0))
# Combine the circle with points on the circle representing the roots
of unity
theta = 2.0*pi/float(n)
p = c + point([(cos(t), sin(t)) for t in srange(0, 2.0*pi,
theta)],frame=True,size=60)
# Add in vectors from the origin to the roots of unity.
p = p + sum([arrow2d( (0,0), (cos(t),sin(t)) ) for t in srange(0,
2.0*pi, theta)])
show(p)
print("The Principle %d-Root: (%5.3f)+(%5.3f)I"%(n,cos(theta),
sin(theta)) )
@interact
def _(n=(1,20)):
plotNthRoots(n)
---------------------------------------------------------
Rather than creating a slider, it generates a plot for the case n=20.
Any suggestions?
Adam Hausknecht
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.