#5453: [with patch, needs review] Create a ring for working with polynomials in
countably infinitely many variables
---------------------------------+------------------------------------------
 Reporter:  mhansen              |       Owner:  mhansen   
     Type:  enhancement          |      Status:  assigned  
 Priority:  major                |   Milestone:  sage-3.4.1
Component:  commutative algebra  |    Keywords:            
---------------------------------+------------------------------------------

Comment(by SimonKing):

 Replying to [comment:8 SimonKing]:
 > No, I only have Sage 3.3. Is Sage 3.4 already out? I'll upgrade, or get
 the 3.4-sources.

 I made it differently: I removed the .rst-part from the patch; after
 removing ReST, the rest worked in Sage 3.3...

 Anyway. I think the whole story should be made more sparse.

 I suggest to use the method {{{change_ring()}}} of polynomial rings in the
 background. Then, {{{stretch()}}} could be implemented along these lines:
 {{{
 sage: R.<x1,y1>=QQ[]
 sage: p=R.random_element()
 sage: p
 -x1^2 - 1/4*y1^2 - 1/2*y1 - 1
 sage: S=R.change_ring(names=['x2','y2'])
 sage: p=S(p)
 sage: p
 -x2^2 - 1/4*y2^2 - 1/2*y2 - 1
 sage: S=S.change_ring(names=['x4','y4'])
 sage: p=S(p)
 sage: p
 -x4^2 - 1/4*y4^2 - 1/2*y4 - 1
 }}}

 In that way, one could keep the underlying ring small.

 Problem though: How to add things, if the underlying polynomial rings are
 different? Probably you know much more about coercion than I do. But I
 guess it should be possible to automatically find a common parent for the
 summands as follows:
 {{{
 sage: q=R.random_element()
 sage: q
 1/3*x1^2 + 1/12*x1*y1 - 3/10*y1^2 + x1
 sage: Varnames=set([str(X) for X in p.variables()]+[str(X) for X in
 q.variables()])
 sage: T=PolynomialRing(QQ,list(Varnames))
 sage: T(p)+T(q)
 -3/10*y1^2 + 1/12*y1*x1 + 1/3*x1^2 - 1/4*y4^2 - x4^2 + x1 - 1/2*y4 - 1
 }}}

 This could be done behind the scenes.

 In the example above, I did not take care about the monomial order,
 though. This needs to be dealt with in a proper implementation.

 Cheers,
     Simon

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5453#comment:9>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to