On 14 June 2016 at 20:30, <janoscharl...@gmail.com> wrote: > I had the same idea earlier, but i dropped it because my intuition was, that > three quadratic equations are worse than three linear and one quadratic > equation :-) > > Since you brought this approach up again, i tried it now, but sympy does not > seem to find a solution. > > You can check out my code here: http://pastebin.com/famnqkLC > > You wrote you expected sympy to find a solution for numeric coefficients, > but i need a symbolic solution because i want to proceed further (by > differentiating with respect so some of the parameters for optimization), > and don't want a sympy.solve step in each optimization step.
You should perhaps explain more clearly what you do want then. You want <X> in terms of <Y> but what are X and Y? > Any idea why my original approach "explodes" in regards of the resulting > expressions? Given your three linear equations you can solve them to get x, y, and cosphi all in terms of sinphi. Then you have that cosphi is: (-(Cux*Cvy - Cuy*Cvx)*(Awx*Cvz*sinphi - Awy*Cuz*sinphi + Cwz) + (Cux*Cvz - Cuz*Cvx)*(Avx*Cvy*sinphi - Avy*Cuy*sinphi + Cwy) - (Cuy*Cvz - Cuz*Cvy)*(Aux*Cvx*sinphi - Auy*Cux*sinphi + Cwx))/(Cux*Cvy*(Awx*Cuz + Awy*Cvz) - Cux*Cvz*(Avx*Cuy + Avy*Cvy) - Cuy*Cvx*(Awx*Cuz + Awy*Cvz) + Cuy*Cvz*(Aux*Cux + Auy*Cvx) + Cuz*Cvx*(Avx*Cuy + Avy*Cvy) - Cuz*Cvy*(Aux*Cux + Auy*Cvx)) Which you can substitute for cosphi in cosphi**2+sinphi**2-1 to get a quadratic in only sinphi. The explosion comes from expanding the cosphi expression (and then squaring!). You have 12 different symbols (excluding sinphi) and all the cross-multiplications gives a combinatoric explosion of terms that aren't easy to factor. I guess what you want to do is rearrange the cosphi expression into the form a*sinphi + b but without expanding a and b. -- Oscar -- 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/CAHVvXxSd%3DQG1n2QAfb_fmSFF995LVh1hxPkWFNLSQ%3DZdm%2BjHBA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.