Sorry if i am being imprecise, but actually i cant describe it better than in my opening post. I want X, Y and Phi in terms of everything else.
Maybe i was wrong in assuming that i could simply pass sympy the system of equations and it would deliver the solutions in a form that i could then use for further processing (auto diff), but the intermediate expression you give for cosphi indicates that there is a much more compact representation of the solution in matrix notations. I understand that sympy only got some (non-matrix) equations, and therefore couldn't introduce matrix operations by itself. But maybe there is some approach i am missing, which would help sympy to use matrix operations in the solution? On Wednesday, June 15, 2016 at 7:06:17 PM UTC+2, Oscar wrote: > > On 14 June 2016 at 20:30, <[email protected] <javascript:>> 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 [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/2c70cbbc-8995-4d04-ae3c-a5a9e9eb9074%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
