# Matrix operations applet

By Murray Bourne, 14 Nov 2007

I recently updated the Matrix Interactive on IntMath.

This interactive is one of the most complicated things I've developed for the site. The demonstration of matrix multiplication was an especially tricky thing to get working properly. Over the last week or so I have been slaving over triple nested loops and having fun re-learning some javascript syntax that had become rusty.

Some of the mathematics used to make this interactive:

• Matrix operations - adding, subtracting, scalar multiplying and multiplying (obviously)
• Random numbers (Math.random in javascript)
• Floor function, which rounds a number down to the nearest integer (Math.floor)
• Maximum and minimum comparisons (Math.max and Math.min)
• Cartesian coordinates (for placing the objects on the screen)
• Geometry (height and width of matrices for spacing)
• Arrays (which are a kind of matrix)
• 3-D Geometry (z-levels of objects for placing things on top of other things)
• Transformational geometry (rotating the left matrix bracket to form the right matrix bracket)
• Hexadecimal numbers (eg 0xABABAB) for colors
• Functions, which are operations that are repeated in the code. You can send variables to a function (eg function createMatrix0(matRows, matCols, type) )

When working on this kind of project I find that I cannot relax until I finish it. I could have spent another few hours giving it some more flair and style, but enough is enough.

Was it worth it? That matrix multiplication page is a high traffic page, so I hope so. Besides, I do enjoy the programming brain challenge.

Yesterday I finally got it all working and published it - go check it out: Matrix Interactive.

### 2 Comments on “Matrix operations applet”

1. Jerry Mascorro Jr says:

I think it is outstanding,
I used it to figure out I was doing it wrong and can now fix my homework before I get a bad grade!

Thank you your hard work and I would love to see the code for it, I can imagine its impressive!.

2. Murray says:

@Jerry: Glad you found it useful.

You can see the code by right-clicking on the page, and choosing "Show page source...", or its equivalent.

### Comment Preview

HTML: You can use simple tags like <b>, <a href="...">, etc.

To enter math, you can can either:

1. Use simple calculator-like input in the following format (surround your math in backticks, or qq on tablet or phone):
a^2 = sqrt(b^2 + c^2)
(See more on ASCIIMath syntax); or
2. Use simple LaTeX in the following format. Surround your math with $$ and $$.
$$\int g dx = \sqrt{\frac{a}{b}}$$
(This is standard simple LaTeX.)

NOTE: You can't mix both types of math entry in your comment.