Stuff is fun

Linear algebra in javascript

Every other week I find myself solving some kind of problem that involves matrix operations or other linear algebra concepts. I still have my old TI-89 from when I was a student. It’s a handy calculator, no doubt about that, older people will even call it a luxury. But quite frankly, I don’t know why we should use calculators considering the speed of an average personal computer. Or even a cellphone in case you’re thinking about throwing the portability argument.
Anyway, rants aside, I was bored so I put together a tiny javascript library with basic linear algebra functions.

Here’s the infamous system of linear equations solve example:

Let’s consider the following system of linear equations:

x + y + z = 1
x + 2y + 3z = 4
x + 4y + 8z = 8

from your first algebra class..

A.x = b
x = Inv(A).b

So let’s just to that

A = [[1,1,1],[1,2,3],[1,4,8]];
b = [[1],[4],[8]];
Ai = inverseMatrix(a);
x = matrixMultiply(Ai,b); //will return the solution [[28],[49],[22]] yay!!!

More examples and download at github.

Mmm…. turns out my rant is all but original.

Related Posts:

Tags: , , ,

4 Responses to “Linear algebra in javascript”

  1. Adalberto Says:

    Great a submit. Standard drawback is usually G. modify ones own spirit far too repeatedly.

  2. Architekt :) Says:

    Really nice and small lib :)
    and … it’s nice to remember 80ies too

  3. concrete cleaner product Says:

    Hi there, You have done a great job. I will certainly digg it and personally suggest to my friends.
    I’m sure they will be benefited from this web site.

  4. Bulk SMS Says:

    Right now my business is content with this unique files as well as would most likely enjoyably experience more with this material. You happen to be an excellent founder possessing a great deal of potential. Enjoy it a lot.

Leave a Reply

. .

Entries (RSS) and Comments (RSS).