Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Getting TypeError for the following code.

The code to plot a surface using parametric_plot_3d:

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

The full list of the error is quite long so, I am list here parts of it. The first few lines are as follows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-1ba937f0390c> in <module>
  1 var("u,v")
  ----> 2 parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v)**RealNumber('0.5').imag(),v],(u,-Integer(1),Integer(1)), (v,-Integer(1),Integer(1)))

  /usr/lib/python3/dist-packages/sage/misc/decorators.py in wrapper(*args, **kwds)
651                     kwds[new_name] = kwds[old_name]
652                     del kwds[old_name]
--> 653             return func(*args, **kwds)
654 
655         return wrapper
.......
.......

The last few lines are:

/usr/lib/python3/dist-packages/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:19026)()
1889             if c.imag == 0:
1890                 return c.real
-> 1891             raise TypeError('unable to coerce to a real number')
1892 
1893     def _complex_double_(self, CDF):

TypeError: unable to coerce to a real number

Getting TypeError for the following code.

The code to plot a surface using parametric_plot_3d:

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

The full list of the error is quite long so, I am list here parts of it. The first few lines are as follows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-1ba937f0390c> in <module>
  1 var("u,v")
  ----> 2 parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v)**RealNumber('0.5').imag(),v],(u,-Integer(1),Integer(1)), (v,-Integer(1),Integer(1)))

  /usr/lib/python3/dist-packages/sage/misc/decorators.py in wrapper(*args, **kwds)
651                     kwds[new_name] = kwds[old_name]
652                     del kwds[old_name]
--> 653             return func(*args, **kwds)
654 
655         return wrapper
.......
.......

The last few lines are:

/usr/lib/python3/dist-packages/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:19026)()
1889             if c.imag == 0:
1890                 return c.real
-> 1891             raise TypeError('unable to coerce to a real number')
1892 
1893     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.

Getting TypeError for the following code.

The code to plot a surface using parametric_plot_3d:

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

The full list of the error is quite long so, I am list here parts of it. The first few lines are as follows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-1ba937f0390c> in <module>
  1 var("u,v")
  ----> 2 parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v)**RealNumber('0.5').imag(),v],(u,-Integer(1),Integer(1)), (v,-Integer(1),Integer(1)))

  /usr/lib/python3/dist-packages/sage/misc/decorators.py in wrapper(*args, **kwds)
651                     kwds[new_name] = kwds[old_name]
652                     del kwds[old_name]
--> 653             return func(*args, **kwds)
654 
655         return wrapper
.......
.......

The last few lines are:

/usr/lib/python3/dist-packages/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:19026)()
1889             if c.imag == 0:
1890                 return c.real
-> 1891             raise TypeError('unable to coerce to a real number')
1892 
1893     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.

Getting TypeError for the following code.

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 list of the error is quite long so, I am list here parts of it. The first few lines are as follows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-1ba937f0390c> in <module>
  1 var("u,v")
  ----> 2 parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v)**RealNumber('0.5').imag(),v],(u,-Integer(1),Integer(1)), (v,-Integer(1),Integer(1)))

  /usr/lib/python3/dist-packages/sage/misc/decorators.py in wrapper(*args, **kwds)
651                     kwds[new_name] = kwds[old_name]
652                     del kwds[old_name]
--> 653             return func(*args, **kwds)
654 
655         return wrapper
.......
.......

The last few lines are:

/usr/lib/python3/dist-packages/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:19026)()
1889             if c.imag == 0:
1890                 return c.real
-> 1891             raise TypeError('unable to coerce to a real number')
1892 
1893     def _complex_double_(self, CDF):

TypeError: unable to coerce to a real number

Edit: I am also getting similar errors using the log log function, arctan arctan function, etc.

Getting TypeError for the following code.

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 list traceback of the error is quite long so, long, so I am list here parts of it. The give only the first few lines are as follows:and last few lines:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-1ba937f0390c> <ipython-input-...-....> in <module>
 ----> 1 var("u,v")
  ----> 2 parametric_plot3d([sqrt(u + I*v).real(), sqrt(u + I*v)**RealNumber('0.5').imag(),v],(u,-Integer(1),Integer(1)), I*v).imag(),v],(u,-Integer(1),Integer(1)), (v,-Integer(1),Integer(1)))

  /usr/lib/python3/dist-packages/sage/misc/decorators.py .../sage/misc/decorators.py in wrapper(*args, **kwds)
651     649                     kwds[new_name] = kwds[old_name]
652     650                     del kwds[old_name]
--> 653 651             return func(*args, **kwds)
654 
655     652
    653         return wrapper
.......
.......

The last few lines are:

/usr/lib/python3/dist-packages/sage/rings/number_field/number_field_element.pyx 
...

.../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:19026)()
1889 (build/cythonized/sage/rings/number_field/number_field_element.cpp:19236)()
   1908             if c.imag == 0:
1890    1909                 return c.real
-> 1891 1910             raise TypeError('unable to coerce to a real number')
1892 
1893    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.

Getting TypeError for the following code.

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.