simplifying RotationMatrix

• To: mathgroup at smc.vnet.net
• Subject: [mg96321] simplifying RotationMatrix
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Wed, 11 Feb 2009 05:23:42 -0500 (EST)
• References: <23667197.1234176058052.JavaMail.root@m02>

```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

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

```

• Prev by Date: Re: Printing (v7)
• Next by Date: Shortest Path Problem
• Previous by thread: Re: Re: Dynamic changing of variables
• Next by thread: Re: simplifying RotationMatrix