import sage.rings.polynomial.multi_polynomial_sequence

asked 2012-02-06 18:05:45 +0100

araichev gravatar image

updated 2012-02-06 18:08:02 +0100

Hi all:

I'm writing some new Sage code to do partial fraction decompositions of multivariate rational expressions and want to use the Sequence() and algebraic_dependence() methods from sage.rings.polynomial.multi_polynomial_sequence. What's the best import call to use?

I've played around with various import calls, and most recently tried the following from within the function i'm writing.

   from sage.structure.sequence import *
   from sage.rings.polynomial.polynomial_ring_constructor import *
   from sage.rings.polynomial.multi_polynomial_sequence import *

I thought that would work and be overkill, but i got the error message

   /Applications/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_sequence.pyc
in algebraic_dependence(self)
   600             T = T+'T'
   601         Ts = [T + str(j) for j in range(r)]
--> 602         RR = PolynomialRing(K,d+r,tuple(Xs+Ts))
   603         Vs = list(RR.gens())
   604         Xs = Vs[0 :d]

NameError: global name 'PolynomialRing' is not defined

Any advice on this particular import or imports in general would be appreciated.

Thanks.

edit retag flag offensive close merge delete

Comments

You want to use it in a worksheet or are you writing an addition to the sage library? If you post an actually failing example instead of some prosaic description of what you'd like to do and an error message then we might be able to help you.

Volker Braun gravatar imageVolker Braun ( 2012-02-06 18:35:29 +0100 )edit

I want to add my code to sage.categories.quotient_fields.py in the Sage library. The code works outside of the library, but i can't get the imports right to include it in the library. Here's the full file: http://dl.dropbox.com/u/3035372/quotient_fields.py .

araichev gravatar imagearaichev ( 2012-02-07 16:29:45 +0100 )edit

importing PolynomialRing in the sage.categories.quotient_field module won't define it in the sage.rings.polynomial.multi_polynomial_sequence module. Can you find a minimal example of an algebraic_dependence() call that fails with the NameError?

Volker Braun gravatar imageVolker Braun ( 2012-02-07 23:38:58 +0100 )edit

Thanks, Volker. I think i'll move this discussion to the Sage trac server: http://trac.sagemath.org/sage_trac/ticket/12417.

araichev gravatar imagearaichev ( 2012-02-08 16:40:01 +0100 )edit