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, 25 Sep 2016 20:21:03 +0200Plotting point when coordinate involves symbolic and numerical valueshttps://ask.sagemath.org/question/34937/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.WojowuSun, 25 Sep 2016 20:21:03 +0200https://ask.sagemath.org/question/34937/Errors when plotting zeta function parametricallyhttps://ask.sagemath.org/question/34882/errors-when-plotting-zeta-function-parametrically/ I have the following piece of code:
def f(x):
return(real_part(zeta(1+x*I)).n())
def g(x):
return(imag_part(zeta(1+x*I)).n())
parametric_plot([f(x),g(x)], (x,2,10))
It should be moderately clear what I'm trying to do - I want to produce a plot of Riemann zeta function on the line Re(z)=1 using parametric plotting. However, when I try to plot this, I get an error `TypeError: cannot evaluate symbolic expression numerically`. I also tried the same thing without the `.n()`, but then I get an error `TypeError: unable to coerce to a real number`. I couldn't find any help online.
It's worth noting that trying to plot function f(x) I get the same error with `.n()`, but it works just fine without it (as opposed to parametric plot). Does anyone have an idea how to fix the issue?
Thanks in advance.WojowuWed, 21 Sep 2016 16:46:11 +0200https://ask.sagemath.org/question/34882/