Andrew Hoyer
 

about

experiments:

(sudoku solver)

(simple fractals)

(cloth simulation)

(numbers to words)

(particle systems)

(quantum cryptography)

(something a day)

(drip sessions)

photos (flickr)

work

 

flickr (dolinski)

facebook

twitter

linkedin

email

 

Getting off the hook:

Any downloadable material on this site is provided as is. If something bad happens, Andrew Hoyer will in no way take any responsibility (though he would most definitely send his heart felt remorse). © 2010 Andrew Hoyer

 
Wikipedia Affiliate Button

Bacon and Eggs:

Experiments / Bacon and Eggs

Bacon and Eggs is a simple linear algebra library written entirely in javascript. More of a proof of concept than anything else, it allows for easy representation of matrices and vectors. On top of that it can solve systems of equations!

Heres a simple example of what bacon and eggs can do:

//define a new matrix 'A' representing
// [1,-4]
// [1, 2]
var A = $M([[1,-4],[1,2]]);

//define a new Vector 'b' representing
// [1,-2]
var b = $V([1,-2]);

//Solve the system!
// x - 4y =  1
// x + 2y = -2
var Solution = A.solve(b);
//returning a vector representing
// x = -1, y = -1/2
// [-1, -0.5]

//find the length of the solution vector
//from the origin for some reason!
var length = Solution.length();

To see more of what Bacon and Eggs can do, make sure you check out the full documentation.

It should be noted that Bacon and Eggs has not been optimized for speed. It was designed merely as a way to experiment with linear algebra algorithms. If you are looking for something that has been optimized, say for graphics purposes, I highly recommend you check out Sylvester by James Coglan.

 

Download (Version 0.1):

The download below contains:

Download Here (bacon_and_eggs.zip 12 KB)

 

Documentation:

There are two classes within Bacon and Eggs, one for matrices the other for vectors. The full documentation of every method (both class and instance) can be found by following the link below:

Full Documentation!

Frequently Asked Questions:

 

• What is Bacon and Eggs good for?

A couple of things. Firstly, its pretty darn good at solving systems of equations. Secondly you can do some rather complex calculations on matrices and vectors. And lastly, if you're interested in seeing how some mathematical algorithms are implemented, you can look through the source code to see how things actually work.

• You say Bacon and Eggs has not be optimized, what do you mean?

I mean that I haven't gone through trying squeeze every cycle to do the most it possibly can. I just really don't want people going through the source code saying, "Why haven't you replaced your for loops with do while loops?", "Why are you using so many variables?", "I see a bunch of unnecessary looping going on, whats up with that?" It does what I want it to do, and if that works for you too great, if not, I'm sorry, but maybe there is something else that will work for you.

• Do you ever plan on optimizing Bacon and Eggs?

I don't think so, no. I set out to try my hand at programming some concepts I learned in a numerical methods course. Thats all. I never wanted to make this into some gung ho library that would blow peoples minds.

• Why did you create Bacon and Eggs?

I remember back in my early days of computing science, when I first started learning to program, thinking to myself, 'Gee golly, wouldn't it be neat to write something to do my linear algebra homework?' It wasn't until a couple years later I took an intro course on numerical methods, in it we were taught how to do many of the things I dreamed of doing in my first year. So Bacon and Eggs is really just an implementation of something I had dreamt of years earlier.

License:

Copyright (c) 2008 Andrew Hoyer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 
Experiments / Bacon and Eggs