MATLAB R14sp3 On Ubuntu 7.04

A couple of things to be aware of if you’re doing this installation, which i discovered through trial and error 🙂

The machine id used for activation is based on the MAC address of eth0. On my machine, for example, my active interface is primarily the wireless card which is set as eth1. Hence, no machine id available for activation. How to fix?

bryan@noah:~$ cat /etc/iftab
# This file assigns persistent names to network interfaces.
# See iftab(5) for syntax.

eth1 mac 00:00:00:00:00:00 arp 1
eth0 mac 11:11:11:11:11:11 arp 1

where 00:00… and 11:11… represent your actual MAC addresses obtained by ifconfig.

My wireless card was eth1, so i simply switched this around so that my wireless is now eth0, rebooted and i now have a machine id with which to activate MATLAB.

Second issue was an error to the tune of: “version GLIBC_2.0 not defined in file libc.so.6” when trying to use the Symbolic Toolkit, particularly. See the MathWorks Technical Solution for more information on this error. The steps they outline there didn’t work for me (it is for Red Hat afterall), but what did work was copying the libmaple.so (provided by MathWorks) into your matlab/glnx/bin directory. See discussion here (in German).

Success. Incidentally, i’m using MATLAB because my university wants me to use it, but otherwise if you need something equivalent in the OSS sphere, try Octave. 😉

Fractions and Foating-Points

Floating-point arithmetic on a computer is hazardous, at best. This post is not a detail description of the problem. Varied descriptions of the problem already abound, like this one, for example. There’s also documented pain out there to understand that it’s not just your computer 🙂 No, this post is just one way of getting around the problem in a particular context.

The environment: JavaScript. The problem: convert decimals to fractions and fractions to decimals. Getting a decimal is straightforward:

function fractiontodecimal( wholenumber, numerator, denominator ) {
wholenumber = parseFloat(wholenumber);
numerator = parseFloat(numerator);
denominator = parseFloat(denominator);
return ( ( ( wholenumber * denominator ) + numerator) / denominator );
}

Obtaining a fraction was slightly more insane since in JavaScript
23.8 * 10 = 238
but
23.88 * 10 = 238.79999999999998

Not exactly what you need to work with. As you can imagine, inside a loop of sorts, and if the number becomes very small and you divide by it, you start getting bigger errors. Anyways, that’s a digression in itself. What i needed was a reliable way to multiple by a float by an integer, 10, and get a predictable response. In other words, i just needed to keep shifting the decimal point. Most immediate response might be: string manipulation. Isn’t that what JavaScript is for? :p

Another way was using e-notation. 23.88 being represented as 23.88e0. Multiply by 10: 23.88e1, and so on. The good news is you still get to do a little string manipulation, but not nearly as hectic as finding and moving a “.”

The particularly heavy looking string manipulation looking like:

newDecimal = mantissa + “e” + exponent;
That wasn’t so hard, now was it? 😀

Browse through the code for decimal.htm (HTLM page with JavaScript)