Re: simplifying RotationMatrix

*To*: mathgroup at smc.vnet.net*Subject*: [mg96366] Re: [mg96321] simplifying RotationMatrix*From*: DrMajorBob <btreat1 at austin.rr.com>*Date*: Thu, 12 Feb 2009 06:38:08 -0500 (EST)*References*: <23667197.1234176058052.JavaMail.root@m02>*Reply-to*: drmajorbob at longhorns.com

I decided a specific "mean" would do, and simplifications gave me the following: Needs["VectorAnalysis`"] SetCoordinates[Spherical]; center = {1, 0, 0}; pt = {1, t, p}; xy = CoordinatesToCartesian /@ {center, pt}; rot = RotationMatrix@xy; LeafCount@rot 1059 rot //. {Conjugate -> Identity, Abs[z_]^2 :> z^2} // Simplify % // LeafCount {{Cos[p]^2 (Cos[t] + Tan[p]^2), -Sin[2 p] Sin[t/2]^2, Cos[p] Sin[t]}, {-Sin[2 p] Sin[t/2]^2, Cos[p]^2 + Cos[t] Sin[p]^2, Sin[p] Sin[t]}, {-Cos[p] Sin[t], -Sin[p] Sin[t], Cos[t]}} 80 Bobby On Wed, 11 Feb 2009 04:23:42 -0600, DrMajorBob <btreat1 at austin.rr.com> wrote: > If I calculate the rotation matrix from one vector to another in > spherical > coordinates, the result is HUGELY complicated: > > Needs["VectorAnalysis`"] > > SetCoordinates[Spherical]; > mean = {1, t0, p0}; > pt = {1, t, p}; > xy = CoordinatesToCartesian /@ {mean, pt}; > rot = RotationMatrix@xy; > LeafCount@rot > > 32798 > > I don't know what to tell Simplify about this, but it seem there are MANY > unnecessary Conjugate mentions: > > Cases[rot, Conjugate[z_], Infinity] // Length > > 1575 > > and MANY unnecessary cases like this, too: > > Cases[rot, Power[Abs[z_], 2], Infinity] // Length > > 1980 > > Each of these could be simply z^2, I think. > > Trying to eliminate these with rules doesn't seem to help much, if any. > > The first thing I thought of was PowerExpand, but > > Map[PowerExpand, rot, {2}] // LeafCount > > 32798 > > What am I missing? How can it be that complicated in the first place? > > Bobby > -- DrMajorBob at longhorns.com