Hi,

On Sun, May 02, 2010 at 08:29:44AM -0700, Ben Goodrich wrote:
> Hi Mateusz,
> 
> This works with the high-level code but does not work with the low-
> level code in polys9:
> 
> from sympy.polys.monomialtools import monomial_lex_key as O_lex
> from sympy.polys.groebnertools import *
> from sympy.polys.polytools import basic_from_dict
> 
> gens = [x,y]
> u = 1
> 
> f = sdp_from_dict(Poly(x, *gens).rep.to_dict(), O_lex)
> g = sdp_from_dict(Poly(y, *gens).rep.to_dict(), O_lex)
> 
> In [9]: sdp_quo(sdp_mul(f, g, u, O_lex, QQ), g, u, O_lex, QQ) # f
> expected
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
> 
> /tmp/mattpap-sympy-polys-9994e86/<ipython console> in <module>()
> 
> /tmp/mattpap-sympy-polys-9994e86/sympy/polys/groebnertools.pyc in
> sdp_quo(f, g, u, O, K)
>     393 def sdp_quo(f, g, u, O, K):
>     394     """Returns polynomial quotient in `K[X]`. """
> --> 395     q, r = sdp_div(f, g, u, O, K)
>     396
>     397     if not r:
> 
> /tmp/mattpap-sympy-polys-9994e86/sympy/polys/groebnertools.pyc in
> sdp_div(f, G, u, O, K)
>     374     while f:
>     375         for i, g in enumerate(G):
> --> 376             tq = term_div(sdp_LT(f, u, K), sdp_LT(g, u, K), K)
>     377
>     378             if tq is not None:
> 
> /tmp/mattpap-sympy-polys-9994e86/sympy/polys/groebnertools.pyc in
> _term_ff_div(a, b, K)
>     340     b_lm, b_lc = b
>     341
> --> 342     monom = monomial_div(a_lm, b_lm)
>     343
>     344     if monom is not None:
> 
> /tmp/mattpap-sympy-polys-9994e86/sympy/polys/monomialtools.pyc in
> monomial_div(A, B)
>     180
>     181     """
> --> 182     C = [ a - b for a, b in zip(A, B) ]
>     183
>     184     if all([ c >= 0 for c in C ]):
> 
> TypeError: zip argument #2 must support iteration
> 

this happens because sdp_quo() implements generalized division
algorithm, so the second argument to sdp_quo() must be a list
(or any other iterable container), e.g.:

 h = sdp_mul(f, g, u, O_lex, QQ)
 q = sdp_quo(h, [g], u, O_lex, QQ)

> Thanks,
> Ben
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sympy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
> 

-- 
Mateusz

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to