On Sat, 2 Mar 2024 at 17:16, Mariyala Rohith <[email protected]> wrote:
>
> Dear Sympy Mentors,
>
>           I hope this message finds you well!
>           I am writing to propose a couple of enhancements to the Pow class 
> in SymPy that I believe could extend its functionality and usefulness.
>
> 1.  Roots of Unity:  I propose to add a method to the Pow class that checks 
> if an expression represents a root of unity. This would involve checking if a 
> complex number, when raised to some positive integer power, equals 1. This 
> feature could be useful in various areas of mathematics, including numbers 
> theory and algebra.

There is already a way to do this in SymPy although it is perhaps not obvious:

In [52]: is_root_of_unity = lambda e: minpoly(e, polys=True).is_cyclotomic

In [53]: is_root_of_unity(-sqrt(5)/4 - S(1)/4 - I*sqrt(S(5)/8 - sqrt(5)/8))
Out[53]: True

In [54]: is_root_of_unity(sqrt(5))
Out[54]: False


Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxSiR9VRR1b%2Bq%2BmOf8g%3DLVhj9LuGCNBM_FsoSUaKGhqFyA%40mail.gmail.com.

Reply via email to