Thank you very much, Oscar. That is excellent feedback. 

You are right. The solver didn't find a solution after about 18h of 
running. For the solver to work, I had broken up my vector equation into 
vector component equations, and while doing that, I chose slightly 
different variables to solve for, too. The equations were still monstrous, 
though, and it is little wonder that the solver found no solution. I will 
give your suggestion to use quaternions a try once I understand what they 
are. :-)

I don't care if the solution I get is too complicated to look at, as long 
as I can implement it and feed it with my known values. I need it to spit 
out the one result I want - that vector CM0 (or CM1, CM2, or CM3 - in real 
life, those will be roughly similar), but even the value c02, c12, c22, or 
c32 would be equally good to know. I still refuse to throw a numerical 
search algorithm at this problem, even though that most likely would work, 
because I hope to better understand the problem (and solution) by solving 
it symbolically. 




Oscar schrieb am Sonntag, 31. Oktober 2021 um 12:45:36 UTC+1:

> On Sat, 30 Oct 2021 at 15:41, Andreas Schuldei <and...@schuldei.org> 
> wrote:
> >
> >
> > Thank you, that seems to have been the issue. I split up the vectors 
> into their coefficients and entered those vector components as separate 
> equations. Now the python process is humming along at 1.8Gbyte memory and 
> low to medium CPU utilization. How long is realistic to wait for a positive 
> result?
>
> Symbolic algorithms often have extremely bad algorithmic complexity so
> it's hard to say.
>
> I took a look at the equations you are solving from the code you
> showed and I don't quite understand what the unknowns are e.g. the
> first 4 equations are:
>
> In [24]: equations[0]
> Out[24]: (c₀₁ - c₁₁)⋅(c₀₁ - m₀₁) + (c₀₂ - c₁₂)⋅(c₀₂ - m₀₂) + (c₀₃ -
> c₁₃)⋅(c₀₃ - m₀₃) = 0
>
> In [25]: equations[1]
> Out[25]: (c₀₁ - c₁₁)⋅(c₁₁ - m₁₁) + (c₀₂ - c₁₂)⋅(c₁₂ - m₁₂) + (c₀₃ -
> c₁₃)⋅(c₁₃ - m₁₃) = 0
>
> In [26]: equations[2]
> Out[26]: (c₀₁ - c₂₁)⋅(c₂₁ - m₂₁) + (c₀₂ - c₂₂)⋅(c₂₂ - m₂₂) + (c₀₃ -
> c₂₃)⋅(c₂₃ - m₂₃) = 0
>
> In [46]: equations[3]
> Out[46]: (c₀₁ - c₃₁)⋅(c₃₁ - m₃₁) + (c₀₂ - c₃₂)⋅(c₃₂ - m₃₂) + (c₀₃ -
> c₃₃)⋅(c₃₃ - m₃₃) = 0
>
> The first unknown listed in the call to solve is CM0:
>
> In [27]: CM0
> Out[27]: (c₀₁ - m₀₁) i_Sys_sensors + (c₀₂ - m₀₂) j_Sys_sensors + (c₀₃
> - m₀₃) k_Sys_sensors
>
> I don't know what it means to solve for this vector quantity. Which of
> the symbols here are the unknowns (the c0i or the m0i)?
>
> If you wanted the m0i then these equations are linear but if you
> wanted the c0i then these first equations are a quadratic polynomial
> system. Either way the complexity of the solutions is going to grow
> quicker than you might expect.
>
> Your next equation 4 equations are monstrous. Here's the first of them
> (I guess this is actually 3 scalar equations once you take
> components):
>
> In [48]: print(equations[4])
> Eq((-B01 + B_x + 2*a*i*mu_0*((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 -
> m03)*sin(theta_i)*cos(theta_j))*((c01 - m01)*cos(theta_j)*cos(theta_k)
> + (c02 - m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))*cos(theta_j)*cos(theta_k)/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 - m03)*sin(theta_j))**2)**2) +
> (sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i))*(a*i*mu_0/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 - m03)*sin(theta_j))**2)) -
> 2*a*i*mu_0*((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))**2/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))**2)**2)))*Sys_sensors.i + (-B02 + B_y +
> 2*a*i*mu_0*((c01 - m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 -
> m03)*sin(theta_i)*cos(theta_j))*((c01 - m01)*cos(theta_j)*cos(theta_k)
> + (c02 - m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))*sin(theta_k)*cos(theta_j)/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 - m03)*sin(theta_j))**2)**2) +
> (sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k))*(a*i*mu_0/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 - m03)*sin(theta_j))**2)) -
> 2*a*i*mu_0*((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))**2/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))**2)**2)))*Sys_sensors.j + (-B03 + B_z -
> 2*a*i*mu_0*((c01 - m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 -
> m03)*sin(theta_i)*cos(theta_j))*((c01 - m01)*cos(theta_j)*cos(theta_k)
> + (c02 - m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))*sin(theta_j)/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 - m03)*sin(theta_j))**2)**2) +
> (a*i*mu_0/(pi*(((c01 - m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 - m03)*sin(theta_j))**2)) -
> 2*a*i*mu_0*((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))**2/(pi*(((c01 -
> m01)*(sin(theta_i)*sin(theta_j)*cos(theta_k) -
> sin(theta_k)*cos(theta_i)) + (c02 -
> m02)*(sin(theta_i)*sin(theta_j)*sin(theta_k) +
> cos(theta_i)*cos(theta_k)) + (c03 - m03)*sin(theta_i)*cos(theta_j))**2
> + ((c01 - m01)*cos(theta_j)*cos(theta_k) + (c02 -
> m02)*sin(theta_k)*cos(theta_j) - (c03 -
> m03)*sin(theta_j))**2)**2))*sin(theta_i)*cos(theta_j))*Sys_sensors.k,
> 0)
>
> If you do get an answer from solve then it will be extremely
> complicated. I doubt though that solve will be able to give an answer
> because it tries to solve polynomial systems in radicals and for a
> fully symbolic system of equations like this you will hit up against
> the Abel-Ruffini limit.
>
> Probably you need to try a different basic approach to your problem
> from the outset like maybe it's better to use quaternions rather than
> rotation angles or something or maybe you shouldn't try to fully solve
> the system algebraically.
>
> The question is what did you want the solutions for? Presumably you
> wanted to use them for some other purpose in which case maybe there's
> another way to achieve that other purpose. If you just want to look at
> the solutions and see what they are then I think that if you do manage
> to get expressions for the solution of this system (from any CAS) they
> are going to be too complicated to just "look at".
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/e36b540d-6b4c-4471-9f9c-c09bdddf3ecfn%40googlegroups.com.

Reply via email to