Perhaps solve_undetermined_coeffs() can do what you want.

Aaron Meurer

On Sat, Jan 14, 2017 at 5:46 AM, Michele Zaffalon
<[email protected]> 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].
> 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/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/CAKgW%3D6L%3Dr4PoGx6ESFd7YjEAFjUT%3DoFF4dOt%2BcAHxnts46kQCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to