Hi, On 16 April 2010 14:39, Ben Goodrich <[email protected]> wrote:
> Hi Mateusz, > > On Apr 16, 4:10 pm, Mateusz Paprocki <[email protected]> wrote: > > > What exactly is gens here? I thought it was supposed to be a list that > > > contains all the symbols in the polynomials, but then I eventually run > > > into this error > > > > > /tmp/mattpap-sympy-polys-cd30a32/sympy/polys/polytools.py in > > > _init_poly_from_list(list_rep, *gens, **args) > > > 286 > > > 287 if len(gens) != 1: > > > --> 288 raise PolynomialError("can't create a multivariate > > > polynomial from a list") > > > > gens is just a list of symbols. The error tells you that you can't create > > multivariate polynomials using nested lists. Use dictionaries instead. > E.g.: > > Poly([1,2,3], x) is ok, but not Poly([[1],[2],[3]], x, y), use > Poly({(2,0): > > 1, (1,0): 2, (0,0): 3}, x, y). > > If gens can be a non-nested list, then maybe there is a bug in quo() ? > When gens is a non-nested list, I can get all the way through your > tutorial, i.e. everything through this works: > > fgh = basic_from_dict(dict(FGH), *gens) > > but I get PolynomialError("can't create a multivariate polynomial from > a list") from > > test = quo(FGH, 1, *gens) > This is all correct, because you are using top-level quo() function with FGH, which is a low-level polynomial representation. Issue quo(basic_from_dict(dict(FGH), *gens), some_expr, *gens), or use sdp_quo() function in the same fashion as sdp_mul, sdp_sub and sdp_sqr were used, e.g. sdp_quo(FGH, [some_sdp_poly_repr], u, O_lex, ZZ). Note using list in the second argument to sdp_quo() is significant, as it uses generalized division algorithm with is used as normal form algorithm in Buchberger's Groebner basis algorithm. some_sdp_poly_repr can be constructed from denom the same way as F, G and H were constructed. Then, on the result from sdp_quo() use basic_from_dict(dict(), *gens) and you will get the desired result (hopefully because the division will be computed over the integers (ZZ)). > > and also if 1 is replaced with a polynomial generated from gens. > > Thanks, > Ben > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] <sympy%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > Mateusz -- You received this message because you are subscribed to the Google Groups "sympy" 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/sympy?hl=en.
