# Numeric precision with iterative matrix rotations

1. Aug 6, 2004

### Kludgy

I couldn't find a forum section on numerical analysis, so I'm writing this here.

I'm on the lookout for simple matrix rotation/multiplication methods that can overcome the precision problems associated with poorly conditioned matrices.

In my case I'm trying to simulate the rotational physics of a thin rod, so the inertia tensor I'm using is very poorly conditioned. (In the basic simulator the major spin axis eventually converges on the angular momentum axis, which is at least stable but not ideal.)

Or if anyone knows of any fast numerical algorithms designed to integrate rigid body motion, that might be useful as well...

thanks!

2. Aug 6, 2004

Have you considered using quaternions to do the rotation? If you search for the phrase "The main problem with encoding a rotation" in this document http://www.sjbrown.co.uk/quaternions.html it will explain a little why I think using quaternions might help.

If you find a solution to your problem outside of PF please post it here. I'm interested.

Last edited: Aug 6, 2004
3. Aug 6, 2004

### Kludgy

Well I am using a quaternion to describe the orientation. Quaternions or not, I get the same drift problem.

Now that you mention that I think I'm wrong and it's not matrix conditioning but just the poor naive integration involved. I noticed yesterday that using smaller simulation steps delays the drift.

Maybe the solution is to do something funky like creating a parametrization in some sort of spherical space and integrating the angles of rotation instead of naively applying euler integration to each element of a quaternion and normalizing.

I'm pretty much making guesses since I don't know where to go with the math...

4. Aug 6, 2004

If the problem is your integration scheme then have you considered using a Verlet algorithm? The error in a Verlet integration is 4th power of the time step. You can google for Leap Frog and "velocity verlet" algorithms in addition to the plain verlet algorithm if it looks like you can adapt this integration technique to your problem.

Last edited: Aug 6, 2004
5. Aug 6, 2004

### Kludgy

Yeah I read that paper on particle based simulation. I do like the advantage of the particle part of that, not having any explicit angular state at all. I wonder how it would behave with my angular control laws?

Verlet integration in general would let me drop the first order state variables, but I'm still looking for a solution to propagate an explicit angular momentum through the body without drift.

6. Aug 6, 2004

### Kludgy

Velocity verlet does look interesting! Looking at that now..