A few minutes after I posted my question, I found that Poly.coeffs does 
what I want and works for multivariate polynomials

```
lin = Poly(expr, x, y).coeffs()
solve(lin, [a,b,c,d,e])
```
with the following definitions
```
x, y = symbols("x, y")
a, b, c, d, e = symbols("a, b, c, d, e")

f = 3*x**2-2*y+1
g = x*y+x-2*y
h = x**2+2*y**2-2
j = x+3
k = x**2-x*y+2
expr = a*f + b*g + c*h + d*j + e*k - (7*x**2 + 2*x*y + 4*x - 4*y**2 - 14*y 
+ 9)

```

On Monday, January 16, 2017 at 5:42:15 AM UTC+1, Aaron Meurer wrote:
>
> Perhaps solve_undetermined_coeffs() can do what you want. 
>
> Aaron Meurer 
>
> On Sat, Jan 14, 2017 at 5:46 AM, Michele Zaffalon 
> <[email protected] <javascript:>> wrote: 
> > I am struggling to find a way of solving the following equation 
> (simplified 
> > example) 
> > ``` 
> > f = x+1 
> > g = 2*x+1 
> > expr = a*f + b*g - 1 
> > solve(expr, (a, b)) 
> > ``` 
> > I would like to have `a=2`, `b=-1` which make `expr` identically zero. 
> > 
> > I am interested in polynomials with higher powers: at the moment, I 
> derive 
> > with respect to x, subs 0 for x, accumulate the result as column in a 
> matrix 
> > and solve the linear problem associated. This method works for 
> univariate 
> > polynomials, but it become impractical for multivariate linear systems, 
> > which is my ultimate goal, because of the need to derive with respect to 
> all 
> > mixed terms x^m*y^n. (I also could not find a way of collecting the 
> > coefficients of the terms x^m*y^n.) 
> > 
> > Is there a way to solve these linear problems? 
> > 
> > Thank you, 
> > michele 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sympy" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sympy. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/sympy/e6b86d1d-fb00-4022-8f25-f80ba0404d2c%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/2695bfdc-7dfd-4b8b-aa7c-54268eb4fec5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to