# TypeError in parametric_plot3d with real or imag

The code to plot a surface using `parametric_plot_3d`

:

```
var("u,v")
parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v).imag(),v],(u,-1,1), (v,-1,1))
```

The full traceback of the error is quite long, so I give only the first few lines and last few lines:

```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-...-....> in <module>
----> 1 parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v).imag(),v],(u,-Integer(1),Integer(1)), (v,-Integer(1),Integer(1)))
.../sage/misc/decorators.py in wrapper(*args, **kwds)
649 kwds[new_name] = kwds[old_name]
650 del kwds[old_name]
--> 651 return func(*args, **kwds)
652
653 return wrapper
...
.../sage/rings/number_field/number_field_element.pyx in sage.rings.number_field.number_field_element.NumberFieldElement.__float__ (build/cythonized/sage/rings/number_field/number_field_element.cpp:19236)()
1908 if c.imag == 0:
1909 return c.real
-> 1910 raise TypeError('unable to coerce to a real number')
1911
1912 def _complex_double_(self, CDF):
TypeError: unable to coerce to a real number
```

Edit: I am also getting similar errors using the `log`

function, `arctan`

function, etc.

errors come from the following

One way out is to use python functions

and so on

It seems to be a bug, but I have some trouble pinpointing it...

EDIT :`FredericC`

's remark points to a problem converting`sage.rings.real_mpfr.RealNumber`

to something palatable to`plot3d`

. However, tring the "manual" conversion on real values succeeds ; I am still unable to reproduce the problem outside of a "plot3d" call...@FrédéricC's I've tried the method you've mentioned. It gives the same type of error.