Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plotting point when coordinate involves symbolic and numerical values

Consider the following single piece of code:

point([real_part(zeta(I))+1,0])

When trying to compile it, I get the following error message:

Error in lines 1-1
Traceback (most recent call last):
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 957, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/plot/point.py", line 353, in point
    return point3d(points, **kwds)
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/plot/plot3d/shapes2.py", line 1143, in point3d
    A = sum([Point(z, size, **kwds) for z in v])
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/plot/plot3d/shapes2.py", line 720, in __init__
    self.loc = (float(center[0]), float(center[1]), float(center[2]))
TypeError: 'sage.symbolic.expression.Expression' object does not support indexing

Is there some simple way to fix this?

Interesting note: I have played around with this error, and it is very unclear to me when it does or doesn't appear. Here are some examples of when the error does appear (as far as I've checked, the traceback is always the same):

point([real_part(zeta(I))+1,0])
point([real_part(zeta(I))*2,0])
point([real_part(zeta(I))+real_part(zeta(I)),0])
point([real_part(zeta(I))/2,0])
point([real_part(zeta(I))-real_part(zeta(2*I)),0])

Here are some examples where it doesn't appear:

point([real_part(zeta(I))+0,0])
point([real_part(zeta(I))*1,0])
point([real_part(zeta(I))*real_part(zeta(I)),0])
point([real_part(zeta(I))+real_part(zeta(2*I)),0])
point([real_part(zeta(I))+imag_part(zeta(I)),0])

I'd be interested if someone figured out under what conditions the error appears or not, because I fail to see any pattern. Thank you in advance.

Plotting point when coordinate involves symbolic and numerical values

Consider the following single piece of code:

point([real_part(zeta(I))+1,0])

When trying to compile it, I get the following error message:

Error in lines 1-1
Traceback (most recent call last):
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 957, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/plot/point.py", line 353, in point
    return point3d(points, **kwds)
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/plot/plot3d/shapes2.py", line 1143, in point3d
    A = sum([Point(z, size, **kwds) for z in v])
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/plot/plot3d/shapes2.py", line 720, in __init__
    self.loc = (float(center[0]), float(center[1]), float(center[2]))
TypeError: 'sage.symbolic.expression.Expression' object does not support indexing

Is there some simple way to fix this?

Interesting note: I have played around with this error, and it is very unclear to me when it does or doesn't appear. Here are some examples of when the error does appear (as far as I've checked, the traceback is always the same):

point([real_part(zeta(I))+1,0])
point([real_part(zeta(I))*2,0])
point([real_part(zeta(I))+real_part(zeta(I)),0])
point([real_part(zeta(I))/2,0])
point([real_part(zeta(I))-real_part(zeta(2*I)),0])

Here are some examples where it doesn't appear:

point([real_part(zeta(I))+0,0])
point([real_part(zeta(I))*1,0])
point([real_part(zeta(I))*real_part(zeta(I)),0])
point([real_part(zeta(I))+real_part(zeta(2*I)),0])
point([real_part(zeta(I))+imag_part(zeta(I)),0])

(edit: the error doesn't seem to ever occur if we give the zeta function a real argument)

I'd be interested if someone figured out under what conditions the error appears or not, because I fail to see any pattern. Thank you in advance.