Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using Sage plotting capability on data from PARI/GP (1)

This is a short follow-up question from this one.

I would like to produce an implicit plot (a contour plot where the real or imaginary values of a function are zero):

var('x,y,s')
g=real(zeta(s))
implicit_plot(lambda x,y:g(x+y*I),(x,-3,3),(y,-3,3))

This works fine, however I want to use GP/Pari to evaluate the zeta function and therefore wrote:

var('x,y')
g=gp("H(s)=zeta(s)")
implicit_plot(lambda x,y:real_part(g(x+y*I)),(x,-3,3),(y,-3,3))

but then keep getting an error message:

PARI/GP ERROR: at top-level: sage[45020]=sage[16][1] ^--- incorrect type in _[_] OCcompo1 [not a vector] (t_REAL).*

For 'normal' plots like this one:

var('x')
g=gp("H(s)=real(zeta(s))")
plot(lambda x:(g(x)),(x,3,6))

the interface with GP works fine, so I probably do something wrong using multiple variables or complex numbers? It doesn't seem to be zeta-function specific (like the pole at s=1), since it also fails for e.g. the cos-function.

Grateful for any advice on how to make this work.

Thanks!