# Revision history [back]

1. First question: The code you are writing does not appear to be redundant with any of Sage's methods. As a comment, note that given a Laurent polynomial p, you can access its parent (the Laurent polynomial ring) using p.parent(), and the corresponding polynomial ring using p.parent().polynomial_ring() so that you do not need to pass the polynomial ring as argument of your last method. In the same way, the number n of variables is accessible through p.parent().ngens().
2. As I wrote in the comment, multivariate polynomials over CC have no method gcd yet. Actually, I forgot that I added such a method in the ticket #20220, that is merged in sage version 7.2beta1. In the cloud.sagemath.com, the current version seems to be version 6.10 (type sage -v in a terminal to get the information), but you can access a more recent version, though potentially buggy, using sage-develop (which is 7.2beta6 apparently, so contains in particular the code I introduced in #20220).
1. First question: The code you are writing does not appear to be redundant with any of Sage's methods. As a comment, note that given a Laurent polynomial p, you can access its parent (the Laurent polynomial ring) using p.parent(), and the corresponding polynomial ring using p.parent().polynomial_ring() so that you do not need to pass the polynomial ring as argument of your last method. In the same way, the number n of variables is accessible through p.parent().ngens().
2. As I wrote in the comment, multivariate polynomials over CC have no method gcd yet. Actually, I forgot that I added such a method in the ticket #20220, that is merged in sage version 7.2beta1. 7.2beta1.¹ In the cloud.sagemath.com, the current version seems to be version 6.10 (type sage -v in a terminal to get the information), but you can access a more recent version, though potentially buggy, using sage-develop (which is 7.2beta6 apparently, so contains in particular the code I introduced in #20220).