Problem : exhibit a concrete example of non-commutative operations to 
students stuck (at best) at high-school level in mathematics.
Idea of solution : use rotations in R^3 : they can been (literally) shown.

But I stumbled on the (apparently) simple step of computing the invariant 
vector (= axis) of the rotation, which fails, except in trivial cases. 
Let's setup an example (editer transcript of a session with cut'n aste from 
an editor) :

sage: var("x,y,z,theta,phi", domain="real")
## Rotation of angle theta about the X axis :
....: 
M_x=matrix([[1,0,0],[0,cos(theta),-sin(theta)],[0,sin(theta),cos(theta)]])
## Ditto, angle phi about the Y axis :
....: M_y=Matrix([[cos(phi),0,-sin(phi)],[0,1,0],[sin(phi),0,cos(phi)]])
## A vector
....: V=vector([x,y,z])
....: 
(x, y, z, theta, phi)

Try to find the axis of (the rotation whose matrix is )M_x :

sage: S_x=solve((M_x*V-V).list(),V.list());S_x
[[x == r1, y == 0, z == 0]]

So far, so good : one solution, easy to check :

sage: V_x=vector(map(lambda e:e.rhs(), S_x[0]))
....: (M_x*V_x-V_x).simplify_trig()
....: 
(0, 0, 0)

Things go pear-shaped when we try to find the axis of the composition of 
the rotations about X and Y axes :

sage: S_yx_bad=solve((M_y*M_x*V-V).list(),V.list());S_yx_bad
[[x == 0, y == 0, z == 0]]

A rotation with no axis ? Now, now...

I have explored a bit this (Maxima) problem, which led me to file Maxima's 
ticket 3239 <https://sourceforge.net/p/maxima/bugs/3239/>. It turns out 
that this is a Maxima error solving a simple linear equarion with 
complicated coefficients.

Now, there is a workaround in sage : use Sympy's solvers :

sage: import sympy
....: D_yx=sympy.solve((M_y*M_x*V-V).list(),V.list());D_yx
....: 
{x: -z*sin(phi)/(cos(phi) - 1), y: z*sin(theta)/(cos(theta) - 1)}

Checking it is a bit more intricate, since this solution is expressed as 
Sympy's objects. But it can be done :

sage: SD_yx={k._sage_():D_yx.get(k)._sage_() for k in D_yx.keys()}
....: V_yx=vector([SD_yx.get(x),SD_yx.get(y),z])
....: (M_y*M_x*V_yx-V_yx).simplify_trig()
....: 
(0, 0, 0)

This one doesn't seem to be covered in the "Solve tickets'" section of the 
Track symbolics <https://trac.sagemath.org/wiki/symbolics> page. Does this 
problem deserve a specific ticket ?

And, by the way, (M_y*M_x).eigenvectors_right() :

   1. needs about 10 minutes to
   2. return an absolutely unusable solution (a few tens pages...).


Is this one known ? Does it deserve a ticket ?

Now for the suggestion : could we emulate what has been done with 
integrate(), and add an option "algorithm=" to Sage's solve ?

HTH,

--
Emmanuel Charpentier

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" 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/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to