From: Jim Freeze Date: 2005-06-08T23:44:09+09:00 Subject: Re: [ANN] StringMatrix * Gavin Kistner [2005-06-08 23:23:31 +0900]: > (This isn't a library I plan on maintaining, but ANN felt like the > right prefix for offering up code for mass enjoyment.) > > At work yesterday I needed to do some algebra on some matrix math to > reverse-derive a value. (To be specific, I needed to figure out how > to draw the three euler rotation values out of a ZXY rotation > matrix.) After spending 2 minutes writing out equations and fearing I > was making a mistake, I turned to Excel and some stupid text > manipulation to produce my formulae. After 10 minutes of messing > around, I got the answer wrong anyhow. > > I decided to write a little Ruby library to do the task for me. I > wrote a matrix class which knows how to do matrix math on strings, > producing formulae from them. After the initial pass produced a lot > of values like "0*sinX" and "0 + 0 + 1*(sinX)" I made it a bit > smarter, so that 0s and 1s properly simplify the equations during > calculation. > > It doesn't produce perfectly-reduced equations by any means, but it > did the trick. In the end, I got my result :) Ahh, a symbolic math library. Gavin, you're a young Wolfram at heart. ;) I remember seeing a symbolic library in the RAA long ago. Don't know if it did matrices, but it did reduction. Possibly you could send the result of your code through its reduction engine as a final step. Nice work. -- Jim Freeze Theory and practice are the same, in theory. -- Ryan Davis