Yes that code works in a single cell for me. When I put it in an
interact and plot I get an error. Below is a simplified part of the
program I am working on. I am using the online notebook. I find when I
comment out the lines with myTangent the plot will display correctly,
so there is something wrong with the line I am trying to create.
sage: @interact
... def myGraph(a = slider(-5, 5,step_size=1, default=0, label='x
value')):
... plotA = plot((x^2), x)
... pointA = point((1,1))
... myB = point((3,3))
... myTangent = line([pointA, myB])
... plotA += pointA
... plotA += myB
... plotA += myTangent
... plotA.show(aspect_ratio=1,xmin=-25, xmax=25, ymin=-25,
ymax=25,figsize=[10, 10])
the error displayed:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_13.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding:
utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("X2ludGVyYWN0Xy5yZWNv
\
bXB1dGUoIjM2Iik="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
File "", line 1, in <module>
File "/tmp/tmppB6Z3A/___code___.py", line 2, in <module>
exec compile(u'_interact_.recompute("36")' + '\n', '', 'single')
File "", line 1, in <module>
File
"/usr/local/sage2/local/lib/python2.6/site-packages/sagenb-0.8-
py2.6.egg\
/sagenb/notebook/interact.py", line 3687, in recompute
S['function']()
File
"/usr/local/sage2/local/lib/python2.6/site-packages/sagenb-0.8-
py2.6.egg\
/sagenb/notebook/interact.py", line 2499, in _
z = f(*[variables[arg] for arg in args])
File "/tmp/tmpTbvlcD/___code___.py", line 8, in myGraph
myTangent = line([pointA, pointB])
File
"/usr/local/sage2/local/lib/python2.6/site-packages/sage/plot/
line.py",
line 243, in line
return line3d(points, **kwds)
File
"/usr/local/sage2/local/lib/python2.6/site-packages/sage/plot/plot3d/
sha\
pes2.py", line 100, in line3d
x, y, z = points[i]
ValueError: need more than 1 value to unpack
On Jun 7, 11:08 am, William Stein <[email protected]> wrote:
> On Mon, Jun 7, 2010 at 3:05 AM, dbjohn <[email protected]> wrote:
> > I wanted to place a line through two points represented as variables.
> > I can do it when explicitly giving coordinates. I wanted to do
> > something like this example:
> > pointA = point((1,1))
> > pointB = point((2,2,))
> > myline = line([pointA, pointB])
>
> > Though I am getting errors like: ValueError: need more than 1 value to
> > unpack
>
> > Would there be any way to achieve this?
>
> sage: pointA= (1,1)
> sage: pointB = (2,2)
> sage: myline = line([pointA, pointB])
> sage: myline
>
>
>
> > --
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group
> > athttp://groups.google.com/group/sage-support
> > URL:http://www.sagemath.org
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://wstein.org
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org