MatrixCalc

MatrixCalc is by far the most ambitious of my Shoes projects - it's an interactive calculator for doing arithmetic on matrices which can add, subtract, multiply and invert matrices up to roughly 10x10. Its user interface will take a bit of explaining. Start by entering the first matrix, clicking the A button which will turn from orange to yellow to show it's active, and then typing in the rows of your matrix separated by spaces and starting each next row by pressing Return. When you have entered all the rows, click the [Enter] button which will have become active yellow too. The A button will go inactive orange again to show the matrix has been accepted. Now enter another matrix into B, and if desired C: you can have three matrices stored at once.

Now click the blue [Expression] button and type in an expression involving the three matrix variables such as A+B, or A*9, or A.inv+B+100. Click the green [Recalculate] button to obtain the answer. You can click [Expression] and enter a new expression as often as required without altering the contents of A, B and C, or you can change A, B and C by clicking their buttons (remember to finish with [Enter] again). You can actually evaluate any valid Ruby expression in the [Expression] slot. The answer gets automatically stored on the clipboard and you can paste it into one of A,B or C by pressing their button and then<Alt-V>. In this way you can evaluate expressions with more than three matrix variables in stages. 

MatrixCalc will accept complex and rational (ie. fraction) values in matrices, which you can enter using the notation c(2,3) - which means the complex number 2+3i - and r(5,6) which means the fraction 5/6. MatrixCalc can display complex numbers and rationals in the result in normal math notation. When working with complex, rational and floating point values (ie. decimals) you can alter the spacing of columns and number of decimal places in the result for better legibility. Do this by pressing the pink [Format] button and entering a format expression as an sprintf format string (the % is prepended automatically). The default is -g, but, say, to display two decimal places with columns 8 spaces apart you would enter -8.2f.

Be warned that the error handling is fairly rudimentary at present: if you type in an illegal expression nothing will happen when you press [Recalculate]. Following several erroneous clicks MatrixCalc may get stuck, in which case restarting it is the best solution. There is no means of saving the variables to file at the moment, though it would be easy enough to add.