Archive for September, 2007

September 29th, 2007

One thing you might reasonably expect computers to do correctly is to multiply two numbers together. Last week though, it transpired that Microsoft Excel 2007 is struggling a bit and needs to go to night classes in order to brush up on arithmetic. If you try to calculate 850*77.1 then Excel 2007 returns the result 100000 which is a little way off from the correct answer of 65,535. Oops!

I discovered this bug in the blog at Wolfram Research but after a little googling it turns out that The Register has also mentioned it. It is not quite as serious as it first looks though – According to this Microsoft blog the bug is only in the function that displays the result. The correct answer is in memory and will be used in subsequent calculations.

I guess that there will be a fix soon but until then feel free to show all of your friends that Excel 2007 can’t do basic mathematics.

September 24th, 2007

While sat in the pub on a damp and grey Friday evening enjoying a few drinks with my friendly neighborhood web-guru, I had the idea of starting a blog with some maths in it. After all, I thought, surely there are not very many blogs all about maths (yes I know that THIS blog has been more about computers than maths so far – but there will be a lot of maths…eventually). I was wrong! Very wrong!

There are LOTS of blogs all about Mathematics and associated subjects and a wonderful tradition has emerged from them all – The Carnivals of Mathematics. The idea is quite simple – a blogger is chosen to be the host of a carnival and then he/she accepts submissions from other bloggers. The host then writes up a blog post which includes a summary of the accepted submissions. The carnivals are a great way of discovering new mathematics and mathematics based blogs and on 21st September the 17th carnival was published over on MathNotations

If the 17 links on this month’s carnival are not enough for you then you can find the locations of all previous carnivals over at carnivalofmathematics.wordpress.com/

September 18th, 2007

When my computers aren’t doing anything important they spend their time looking for large prime numbers using the software provided by the people over at the Great Internet Mersenne Prime Search (GIMPS). In particular the software looks for Mersenne Primes which have the form

 \light 2^p-1

Mersenne Primes are very rare – only 44 are known at the time of writing and the GIMPS project is looking for new ones. Their most recent find was a prime number with 9,152,052 digits (currently the largest known prime number of any kind) and the race is on to find one with over 10,000,000 digits. Since a group called the Electronic Frontier Foundation has put up a prize of $100,000 for the discovery of such a prime, a lot more than fame awaits any potential discoverer.

Everyone with a computer and an internet connection can have a stab at looking for mersenne primes. All you need to do is go over to the GIMPS website, download their (free) software and run it. It will ask you some questions in order to create an account and then will ask the primenet server for a unallocated prime to test. Once it is up and running there is literally nothing else you have to do as it takes care of itself – returning results and requesting new numbers to test automagically.

Why do I mention this now? Well I just checked my stats and it seems that my machines have done an amount of work equivalent to a Pentium 90 running non-stop for 115 years (I am not sure why it measures time in Pentium 90 units). That’s not bad going since I only opened my account in March.

Finally, If you find the 10 million digit prime and win the prize money then what better way of spending some of the money than buying a framed copy of your record breaking number.

September 14th, 2007

One of the great things about browsing the Internet is that you never know where you are going to end up. Recently, I have taken to looking at new entries on the Wolfram Demonstrations page (mentioned in an earlier blog post) and, if I find something interesting, I follow it up. By doing this I have discovered all sorts of delightful (but, it has to be said, mostly useless) mathematical tidbits.

My most recent find is a demonstration entitled ‘Polygons arranged in a circle‘ which produces some attractive looking flower-like designs by drawing a set of identical regular polygons arranged in a circle. The instant I set eyes on the preview I had a sense of deja-vu. Not only had I seen such patterns before but I had written the code to produce them when I was a child of around 10 on a BBC Micro using the Logo programming language. These were probably among the first codes I had ever written in my life and started a lifelong fascination with programming that is still with me today.

The Logo programming language is a dialect of Lisp that was developed in the late 60s by Daniel Bobrow and Wallace Feurzeig of BBN in collaboration with Seymour Papert of MIT. You may not have heard of BBN but, along with developing Logo, they were the company that developed the Arpanet – widely held to be the precursor of the internet. They also put the @ symbol in email addresses by the way.

Back in the 60s it was much harder to program computers than it is now and Logo was developed as a learning tool for children. It was designed not just to help teach programming but also to help teach concepts from mathematics such as geometry and algebra. For more about the history of Logo you might like to read Wallace Feurzeig’s ‘The LOGO Lineage’ -originally published in 1984 as part of the book ‘Digital Deli’.

Although it is a very powerful language (and to get an idea of just how powerful take a look at Brian Harvey’s set of 3 Logo-centric computer science books available for download from here), Logo is best known for it’s Turtle Graphics. The turtle was originally a robot that moved around the floor, holding a pen and controlled by a computer using Logo. These days it is represented by a sprite on a computer screen. Using Logo and the turtle you can write programs to draw anything you like. The commands are simple – for example:

forward 20 – moves forward 20 units
right 90 – rotates to the right 90 degrees
repeat n [ ] – repeat the commands in the brackets n times.

So to draw a square

repeat 4 [forward 20 right 90]

we can also write subroutines – here is one that will draw a hexagon

to hexagon
repeat 6 [forward 20 right 60]
end

We are now just one step from reproducing the type of graphics in the Mathematica demonstration

to flower
repeat 30 [ hexagon right 12]
end

running the command ‘flower’ will produce the pattern below.

With a little thought (and one or 2 extra commands not mentioned here) you can modify the code to produce any of the designs in the Wolfram Demonstration. This is all well and good but how do you get Logo on your PC? I found a great implementation called Berkeley logo – there are many others but this one seems to be among the best. If you have Ubuntu Linux then the command to install it is

sudo apt get install ucblogo

A gentle introduction to the Logo language can be found at the Logo foundation. You should bear in mind that, unlike languages such as C, there is no standard syntax for Logo and so the language varies from implementation to implementation. To get an idea of the number of implementations out there take a look at The Great Logo atlas.

This little investigation started out as a nostalgia trip for me but has ended up being a bit more than that. I thought Logo was a dead language from my past but it seems that it is still very much alive and well. It even has an active usenet group. When I was learning Logo at school we didn’t take it much further than the geometric pictures shown above which is a shame because it is clearly a very powerful language.

Since I already have to keep so many languages in my head for professional reasons, I doubt that I will use Logo for anything serious but will almost certainly be playing with it from time to time. Logo is fun and sometimes I forget that I got into programming in the first place because it can be fun.

September 12th, 2007

I am in the middle of a small project written using the Perl scripting language and I found myself wanting to be able to plot a graph. Now I have faced this problem before and last time I cheated and got my Perl script to talk to the superb open source plotting program, gnuplot. This worked just fine but for various reason I wanted to code the whole thing in Perl itself this time – no talking to external programs.

A bit of googling around and I hit upon the GD::Graph Perl module. Once I had this installed I was producing graphs in .png format in no time. Now the resulting plots are not the prettiest I have ever seen but they do the job and maybe with a bit of tweaking they can be made to look a bit nicer. An example Bar chart is shown below (the text is distorted due to resizing the image – not because that’s how it actually looks)

A lot of sample scripts are included with the package and over at gdgraph.com you can see what all of the resulting plots look like. All in all it’s a nice little package and is still under active development.

September 7th, 2007

I have just returned home from a wonderful holiday in the south of France (The village of Valbonne to be precise) and while I was there I re-discovered a stunning looking vegetable called a Romanesco. I stumbled across these for the first time last year at an organic farmers market where I bored my wife to tears explaining how this was the perfect example of a fractal. I liked the look of them so much that I bought several and so it was very lucky that they happen to taste good as well.

a romanesco

At the time of writing if you google for ‘Fractal Food’ then the top search result is the following great website which includes the above picture along with some of the mathematics of fractals. It also has a couple of recipes (which is unusual for a site about mathematics).

http://www.fourmilab.ch/images/Romanesco/

TOP