1 | initial version |
This is a long comment rather than an answer.
Many of Sage's plotting functions, including, plot
, parametric_plot
, implicit_plot
,
plot3d
, parametric_plot3d
, implicit_plot3d
, can accept as arguments
either symbolic expressions or callable functions.
If symbolic expressions are used, as in the question, Sage tries to convert them into "fast callable" functions.
The very long error traceback in the question shows
the code path goes through a number of functions in
sage/symbolic/expression_conversions.py
, sage/symbolic/expression.pyx
,
sage/ext/fast_callable.pyx
, sage/ext/fast_eval.pyx
, as one might expect
(although it's really long), and finally, quite unexpectedly I think,
in sage/rings/number_field/number_field_element.pyx
.
I don't fully understand the problem there, so I would not know how to get the desired plot using symbolic expressions.
Using callable functions that are not symbolic expressions, as @FrédéricC
suggests, no need to define the variables with var
before plotting,
or to recall their names in the ranges.
This could be done as follows:
sage: xyz = [lambda u, v: sqrt(u + I*v).real(), lambda u, v: sqrt(u + I*v).imag(), lambda u, v: v]
sage: parametric_plot3d(xyz, (-1, 1), (-1, 1))
or less condensed:
sage: xuv = lambda u, v: sqrt(u + I*v).real()
sage: yuv = lambda u, v: sqrt(u + I*v).imag()
sage: zuv = lambda u, v: v
sage: parametric_plot3d([xuv, yuv, zuv], (-1, 1), (-1, 1))
or with a different color and some transparency:
sage: parametric_plot3d([xuv, yuv, zuv], (-1, 1), (-1, 1), color='steelblue', opacity=0.5)