What is the Sympy function for $\nu_2(n)$ the 2-adic valuation of $n$?

68 views
Skip to first unread message

Luna Tuna

unread,
Feb 13, 2022, 2:37:07 AM2/13/22
to sympy
Hi, googling turns up nothing. 

Was wondering if Sympy has a v_2(n) function such that it's part of the expression tree and so Sympy knows about rules such as v_2's complete additivity, i.e. v_2(xy) = v_2(x) + v_2(y) and so on and can thus simplify expressions involving it if possible.

Thanks!

Aaron Meurer

unread,
Feb 13, 2022, 2:46:32 AM2/13/22
to sy...@googlegroups.com
This is the closest thing. It is only in the development version of SymPy, but 1.10 will be released with it soon. https://docs.sympy.org/dev/modules/polys/numberfields.html#p-adic-valuation

Depending on what you want to do you can easily define your own by subclassing Function and defining the appropriate methods.

Aaron Meurer

--
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 sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/9c96f1ca-9d63-4e02-8f53-4f2ba6e81293n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages