| 1 | initial version |
A more complete answer:
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().
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).
| 2 | No.2 Revision |
A more complete answer:
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().
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).
¹ That is, it will be available in the future version 7.2 of Sage.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.