Ask Your Question

Revision history [back]

First, you really need to provide the explicit construction of th objects, so that we can try to reproduce.

Without more information, let me assume that the P you speak about is of this form:

sage: H = HyperbolicPlane().PD()
sage: P = H.random_element()
sage: P
Point in PD 0.457058290632951 - 0.778395192442617*I

Indeed:

sage: real_part(P)
TypeError: cannot coerce arguments: no canonical coercion from Hyperbolic plane in the Poincare Disk Model to Symbolic Ring

To find a method related to some object, a very nice way is to use tab-completion, that is you type:

sage: P.<TAB>

Where <TAB> stands for the tab-key (which looks like two arrows on your keyboard).

There, you will find:

sage: P.coordinates()
0.457058290632951 - 0.778395192442617*I
sage: parent(P.coordinates())
Symbolic Ring

Which looks good, given the previous error message, and indeed, the following works:

sage: C = P.coordinates()
sage: word = text('my word',(real_part(C),imag_part(C)), color='black')
sage: word
Launched png viewer for Graphics object consisting of 1 graphics primitive