How to make homework more fun: Matlab to Ruby
Or you could just use Octave, which is an open-source Matlab clone that has almost all its core features:
Along the same vein whenever I'm doing my physics homework I like to take the sample code whether it's R, Matlab,c etc. And convert it to python/numpy/scipy. I find I get a much deeper understanding that way and working with ipython notebook is a great workflow for prototyping.
I never did find a solution to the performance problem when it comes to writing numeric code in Ruby. I ended up doing most of my Matlab-suggested assignments in Python with numpy instead.
As far as I have oberseved, Python is more widely used than Ruby as a scientific tool.
The reasons are great libraries like numpy, scipy and sympy (for symbolic expressions). Also, I think the standard library of Python is better designed more consistent.
SciRuby is not on par with alternative such as NumPy/SciPy and Octave, but NMatrix (its linear algebra lib) seems to be nice: https://github.com/SciRuby/nmatrix
FreeMAT is a really good OS clone of Matlab.
If the OP was able to run his homework files just by monkeypatching a few classes, I think that shows requiring Matlab for the assignment was massive overkill. Unless you're using the toolboxes (which they weren't), what does Matlab give you that you can't get in free language?
Your homework is weird, because you are just evaluating a function instead of evaluating Maxwell's equations. Check out FDTD.
Matlab and several related programming languages are designed for carrying out mathematical calculations. Ruby is designed to be a multi-purpose language that has found a niche in Web-development. My advice is to use the right tool for the job, and not to try and force a round cylinder into a square hole.