Is this the sort of thing you're looking for?

def matrix_rep(z):
    """
    INPUT: complex number z = a + bi
    OUTPUT: the matrix
       [a -b]
       [b  a]
    """
    a = z.real_part()
    b = z.imag_part()
    return matrix(RR, [[a, -b], [b, a]])

On Friday, July 1, 2022 at 3:04:40 AM UTC-7 hongy...@gmail.com wrote:

> How can I find the matrix representations corresponding to complex numbers 
> and quaternions with the help of SageMath <https://www.sagemath.org/>, 
> i.e., the ring isomorphism 
> <https://en.wikipedia.org/wiki/Ring_isomorphism> from the field of 
> complex numbers and quaternions to the rings of corresponding matrices, 
> respectively, as described here 
> <https://en.wikipedia.org/wiki/Complex_number#Matrix_representation_of_complex_numbers>
>  
> and here <https://en.wikipedia.org/wiki/Quaternion#Matrix_representations>
> ?
>
> Regards,
> HZ
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/143f4daf-9e77-4b1b-92f4-ab8cde91a1bbn%40googlegroups.com.

Reply via email to