Alan, I don't understand everything you write here due to my lack of math understanding. Can you possibly explain it like I was five?
Do I understand correctly that quaternions are not the solution to my unique needs regarding rotations because quaternions only rotate around an axis through the origin? And I have two rotations, and at least one of them is away from the origin, which would require an additional translation, which is incompatible with quaternions? brombo schrieb am Montag, 1. November 2021 um 00:21:28 UTC+1: > Also note that for 3D quaternions are subalgebra of the geometric > algebra. Hamilton did not come up with the pseudoscalar which allows > scalars, vectors, quaternions, and the pseudoscalar to form a complete > algebra. In Hamiltons quaternions you can add scalars to the basis > quaternions but you cannot add vectors to either. Remember Hamilton's i, > j, and k are isomorphic to the basis vectors but they are not vectors > themselves. > > On 10/31/21 6:50 PM, Oscar Benjamin wrote: > > On Sun, 31 Oct 2021 at 20:10, Andreas Schuldei <and...@schuldei.org> > wrote: > >> 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. :-) > > They might not help but I have sometimes found that problems involving > > fully arbitrary 3D rotations can be handled more simply with > > quaternions. > > > >> 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. > > It might be possible to solve a subset of your equations for a subset > > of your unknowns to get a partial analytic solution. > > > >> 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. > > If your ultimate goal is to feed in values then why is it better to do > > that after calling solve rather than before? You say that you want to > > better understand the problem and solution but I think that if you got > > a solution in general symbols here then it would be so monstrously > > complicated that it wouldn't help to understand anything. > > > > Analytic solutions are nice when they are possible and not overly > > complicated. Numerics are more widely used than symbolics precisely > > because many problems do not have useful analytic solutions but can be > > handled numerically. > > > > > > Oscar > > > >> > >> > >> > >> 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+un...@googlegroups.com. > >> To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/e36b540d-6b4c-4471-9f9c-c09bdddf3ecfn%40googlegroups.com > . > -- 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/335e72f1-3e69-46ae-b6e2-c888814181edn%40googlegroups.com.