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.Sun, 01 Feb 2015 08:46:08 +0100Sage behaves different locally vs. in cloud.sagemath.comhttps://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/ I was trying to plot some complex numbers, with the following code:
data1 = []
data2 = []
for i in range(15):
theta = 2*pi*i/15.0
v = e^(I*theta) + 3
w = e^(I*theta) + 3*I
data1.append(v)
data2.append(w)
list_plot(data1)
# list_plot(data2)
But for some reason, an error occurs when I try to plot data2. (But no error for data1...)
The traceback for the error is the following:
----------------
Traceback (most recent call last): data1.append(v)
File "", line 1, in <module>
File "/private/var/folders/9r/5rcwvsmn0jxb2452tv5csp1m0000gn/T/tmp4032QP/___code___.py", line 12, in <module>
exec compile(u'list_plot(data2)
File "", line 1, in <module>
File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 550, in wrapper
return func(*args, **options)
File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1888, in list_plot
data = [(z.real(), z.imag()) for z in [CC(z[1]) for z in data]]
TypeError: 'sage.symbolic.expression.Expression' object does not support indexing
--------------
The error doesn't appear if I try the putting the code on cloud.sagemath.com, which seems to imply that sage is not working properly on my computer? If so, how might I fix this?
Fri, 30 Jan 2015 10:32:14 +0100https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/Comment by evanw2 for <p>I was trying to plot some complex numbers, with the following code:</p>
<pre><code>data1 = []
data2 = []
for i in range(15):
theta = 2*pi*i/15.0
v = e^(I*theta) + 3
w = e^(I*theta) + 3*I
data1.append(v)
data2.append(w)
list_plot(data1)
# list_plot(data2)
</code></pre>
<p>But for some reason, an error occurs when I try to plot data2. (But no error for data1...) </p>
<p>The traceback for the error is the following:</p>
<hr/>
<p>Traceback (most recent call last): data1.append(v)
File "", line 1, in <module></p>
<p>File "/private/var/folders/9r/5rcwvsmn0jxb2452tv5csp1m0000gn/T/tmp4032QP/___code___.py", line 12, in <module>
exec compile(u'list_plot(data2)
File "", line 1, in <module></p>
<p>File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 550, in wrapper
return func(<em>args, *</em>options)
File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1888, in list_plot
data = [(z.real(), z.imag()) for z in [CC(z[1]) for z in data]]
TypeError: 'sage.symbolic.expression.Expression' object does not support indexing</p>
<hr/>
<p>The error doesn't appear if I try the putting the code on <a href="http://cloud.sagemath.com">cloud.sagemath.com</a>, which seems to imply that sage is not working properly on my computer? If so, how might I fix this?</p>
https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/?comment=25664#post-id-25664After installing 6.4.1, it now works, so that is good.Sun, 01 Feb 2015 08:46:08 +0100https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/?comment=25664#post-id-25664Comment by John Palmieri for <p>I was trying to plot some complex numbers, with the following code:</p>
<pre><code>data1 = []
data2 = []
for i in range(15):
theta = 2*pi*i/15.0
v = e^(I*theta) + 3
w = e^(I*theta) + 3*I
data1.append(v)
data2.append(w)
list_plot(data1)
# list_plot(data2)
</code></pre>
<p>But for some reason, an error occurs when I try to plot data2. (But no error for data1...) </p>
<p>The traceback for the error is the following:</p>
<hr/>
<p>Traceback (most recent call last): data1.append(v)
File "", line 1, in <module></p>
<p>File "/private/var/folders/9r/5rcwvsmn0jxb2452tv5csp1m0000gn/T/tmp4032QP/___code___.py", line 12, in <module>
exec compile(u'list_plot(data2)
File "", line 1, in <module></p>
<p>File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 550, in wrapper
return func(<em>args, *</em>options)
File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1888, in list_plot
data = [(z.real(), z.imag()) for z in [CC(z[1]) for z in data]]
TypeError: 'sage.symbolic.expression.Expression' object does not support indexing</p>
<hr/>
<p>The error doesn't appear if I try the putting the code on <a href="http://cloud.sagemath.com">cloud.sagemath.com</a>, which seems to imply that sage is not working properly on my computer? If so, how might I fix this?</p>
https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/?comment=25655#post-id-25655On my mac, I have no problems with this code with Sage 6.0 and also a beta version of Sage 6.5. Did you run just this code, or have you executed other things which could be interfering (like redefining `I`, `e`, or `pi`, for example)?Fri, 30 Jan 2015 17:47:50 +0100https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/?comment=25655#post-id-25655Comment by tmonteil for <p>I was trying to plot some complex numbers, with the following code:</p>
<pre><code>data1 = []
data2 = []
for i in range(15):
theta = 2*pi*i/15.0
v = e^(I*theta) + 3
w = e^(I*theta) + 3*I
data1.append(v)
data2.append(w)
list_plot(data1)
# list_plot(data2)
</code></pre>
<p>But for some reason, an error occurs when I try to plot data2. (But no error for data1...) </p>
<p>The traceback for the error is the following:</p>
<hr/>
<p>Traceback (most recent call last): data1.append(v)
File "", line 1, in <module></p>
<p>File "/private/var/folders/9r/5rcwvsmn0jxb2452tv5csp1m0000gn/T/tmp4032QP/___code___.py", line 12, in <module>
exec compile(u'list_plot(data2)
File "", line 1, in <module></p>
<p>File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 550, in wrapper
return func(<em>args, *</em>options)
File "/Applications/Sage-6.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1888, in list_plot
data = [(z.real(), z.imag()) for z in [CC(z[1]) for z in data]]
TypeError: 'sage.symbolic.expression.Expression' object does not support indexing</p>
<hr/>
<p>The error doesn't appear if I try the putting the code on <a href="http://cloud.sagemath.com">cloud.sagemath.com</a>, which seems to imply that sage is not working properly on my computer? If so, how might I fix this?</p>
https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/?comment=25650#post-id-25650I am not on mac, but Debian GNU/Linux, if it can help in debugging, it works for me. Also, it might be good to try installing a more recent version of Sage, that is 6.4.1 or 6.5 if you wait a few days.Fri, 30 Jan 2015 12:41:48 +0100https://ask.sagemath.org/question/25645/sage-behaves-different-locally-vs-in-cloudsagemathcom/?comment=25650#post-id-25650