Hey Salvatore,

first of all thank you for your answer, it looks like you are one of the 
> person I pester the most with these issues. 
>

I think I'm the one who knows the most about this because I have made the 
most recent additions and fixes to that part of Sage (although I'm happy to 
be wrong on this point). 

>
> As far as gcd business goes my point is not that the current behaviour is 
> necessarily wrong but it is inconsistent. What I mean is that 
>
> sage: L = LaurentPolynomialRing(ZZ, 'x0,x1,y0,y1') 
> sage: R = LaurentPolynomialRing(LaurentPolynomialRing(ZZ, 'y0,y1'), 
> 'x0,x1') 
>
> mathematically should be (almost) the same object but 
>
> sage: L.inject_variables() 
> Defining x0, x1, y0, y1 
> sage: (x0+1)/(x0+1) 
> 1 
> sage: R.inject_variables() 
> Defining x0, x1 
> sage: (x0+1)/(x0+1) 
> (x0 + 1)/(x0 + 1) 
>
> Their fraction fields are indeed different but elements belonging to both 
> should have the same properties. This is not the case at the moment: 
>
> sage: L = L.fraction_field() 
> sage: R = R.fraction_field() 
> sage: L.inject_variables() 
> Defining x0, x1, y0, y1 
> sage: (x0+1).gcd(x0+1) 
> x0 + 1 
> sage: R.inject_variables() 
> Defining x0, x1 
> sage: (x0+1).gcd(x0+1) 
> 1 
>
>
> I agree with you that a rewrite might not be a good use of anyone's time 
> so 
> we should start bug hunting first.  I will open a ticket with the last of 
> the 
> issues I pointed out in my previous e-mail as soon as I can find a 
> solution. 
>

I suspect it all comes down to defining a gcd of the multivariate Laurent 
polynomial ring and this fixing the issues. Although this may not be the 
only problem because of the fact that these fraction fields are different. 
I think this is true even mathematically speaking as one is rational 
functions in x0, x1, y0, y0, with coefficients in ZZ and the rational 
functions in y0, y1 with coefficients in the Laurent polynomial ring x0, x1 
over ZZ as (y0 + y1) / (y0 - y1) is not in the latter I believe.

>
> One design question: can someone explain to me the rationale of having two 
> implementations for Laurent polynomials (one univariate and one 
> multivariate) 
> and then a wrapper factory function on top? If the idea is that some 
> methods 
> are defined only in special cases would it not be easier to add them at 
> __init__ time with something like 
> self.mymethod = MethodType(mymethod, self, self.__class__) 
> This would allow to expose directly two classes LaurentPolynomialRing and 
> LaurentPolynomial instead of a factory function. 
>
>    I see two big reasons. The first is speed and memory efficiency because 
the internal structure of the univariate is more simple than the 
multivariate. The second is there are more algorithms/methods for the 
univariate (which is an argument for subclassing, or at least possibly 
separating out common functionality into an ABC).

Best,
Travis

 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to