Hey Guys,

I want to add a symbolic expression to CC representing an primitive n-th root of unity analogous to 'I'.

Lets call this Element xi_n, besides the usual rules xi_n should satisfy the following properties:

* (xi_n in CC) == true
* xi.parent() == CC
* (exp(2 * pi * I / n) == xi_n)
* latex(xi_n) == "\xi_n"

Maybe the first two conditions are equivalent. I played around with sage.symbolic.expression.Expression and sage.structure.element.CommutativeRingElement but did not get any idea how to start. I was also looking for a piece of code defining I, but i did not have any success.

Is there already an implementation I can use (extend)? Or what is the best way implement this?

My main idea is to inherit from a suitable base class and override the _pow_ function.

But this results in this error:

sage: xi = NthRootOfUnity(3,parent=CC)
sage: xi**2

TypeError: unsupported operand parent(s) for '*': 'Complex Field with 53 bits of precision' and 'Complex Field with 53 bits of precision'


best regards,
Johannes

--
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to