Ask Your Question

Revision history [back]

Try declaring the variables as real.

This is done using domain=real.

sage: x, y, z = SR.var('x, y, z', domain='real')
sage: assumptions()
[x is real, y is real, z is real]
sage: z1, z2 = -1, 1
sage: ni = 10*(z2 - z1)
sage: dz = (z2 - z1)/ni
sage: def col3(x, y, z):
....:     return float(0.5*dz + floor((z - z1)/dz)/ni)
....:
sage: surf = implicit_plot3d(z-real(sqrt(x + I*y)), (x, -2, 2), (y, -2, 2), (z, -1, 1), color=(col3, colormaps.jet))
sage: surf.show(aspect_ratio=(1, 1, 2))
Launched html viewer for Graphics3d Object

SageMath implicit 3D plot with colormap

Try declaring the variables as real.

This is done using domain=realdomain='real'.

That seems to help in this case, see the result below.

sage: x, y, z = SR.var('x, y, z', domain='real')
sage: assumptions()
[x is real, y is real, z is real]
sage: z1, z2 = -1, 1
sage: ni = 10*(z2 - z1)
sage: dz = (z2 - z1)/ni
sage: def col3(x, y, z):
....:     return float(0.5*dz + floor((z - z1)/dz)/ni)
....:
sage: surf f = implicit_plot3d(z-real(sqrt(x z-real(sqrt(x + I*y)), I*y))
sage: xx, yy, zz = (x, -2, 2), (y, -2, 2), (z, -1, 1), color=(col3, colormaps.jet))
1)
sage: cc = (col3, colormaps.jet)
sage: surf = implicit_plot3d(f, xx, yy, zz, color=cc)
sage: surf.show(aspect_ratio=(1, 1, 2))
Launched html viewer for Graphics3d Object

SageMath implicit 3D plot with colormap