import sage.rings.polynomial.multi_polynomial_sequence

asked 2012-02-06 11:05:45 -0500

araichev gravatar image

updated 2012-02-06 11:08:02 -0500

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

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.


edit retag flag offensive close merge delete


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 11:35:29 -0500 )edit

I want to add my code to 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: .

araichev gravatar imagearaichev ( 2012-02-07 09:29:45 -0500 )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 16:38:58 -0500 )edit

Thanks, Volker. I think i'll move this discussion to the Sage trac server:

araichev gravatar imagearaichev ( 2012-02-08 09:40:01 -0500 )edit