I was going to suggest solve_undetermined_coeffs, but it doesn't seem to work on multivariate polynomials.
Aaron Meurer On Thu, Apr 7, 2016 at 12:30 AM, Jason Moore <moorepa...@gmail.com> wrote: > Say I have an expression that I know is quadratic in u1, u2, u3: > > expr = k00*u1**2 + k01*u1*u2 + k02*u1*u3 + k10*u1*u2 + k11*u2**2 + k12*u2*u3 > + k20*u1*u3 + k21*u2*u3 + k22*u3**2 > > Is there a simple way to transform this into: > > expr = u^T * K * u > > Where u = [u1, u2, u3]^T and K is a 3 x 3 matrix? > > I know I can expand the expression with respect to the u variables and pick > off coefficients, but I was wondering if we happened to have anything > implemented that doe this. > > > Jason > moorepants.info > +01 530-601-9791 > > -- > 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 sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > 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/CAP7f1AiYi1CeE%3D2yFX1GMfNmvi56PksinPYcN5AX%2B%2BEccFiHxg%40mail.gmail.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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. 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%3D6Lb0feF3944C6sK5nKBTenTGpabMh3Qo_-iBO8mttkBMA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.