Archive for December, 2008

December 30th, 2008

Welcome to this – the last Carnival of Mathematics in 2008.  Sadly, submissions were on the low side this time around – probably due to the fact that many people were away from the internet over the festive season (and so they should be).  Rather than let this adversely affect the size of this carnival, I broke every rule in the carnival book and went searching for some submissions of my own.  I hope you enjoy the results…

Carnival tradition dictates that before I start the show I should entertain you all with some mathematical facts about the number 46 (since this is the 46th edition of the carnival – for those of you who have imbibed too much festive cheer) and I have managed to come up with:

With tradition satisfied lets look at this edition’s submissions.

Rod Carvalho of Reasonable Deviations shows how to construct polynomials from their roots using a graphical approach.  This is a nice way of viewing the process of constructing polynomials, as all the cumbersome algebraic manipulation boils down to assigning values to the nodes of a graph.

Maria Andersen of TCMTB shows how to create an answer key to your calculus test (or any other test for that matter) using Windows Journal.  I have to confess that I have not used Windows Journal because it is part of Windows Vista – something I only ever use under duress.  Maria makes it look rather compelling though so maybe I need to convince a friend of mine to lend me their laptop!

John D. Cook of The Endeavour gives us a Constructive proof of the Chinese Remainder Theorem.  This comes at a good time for me because as part of my ‘fill in the huge gaps in my maths knowledge’ project, I have been learning about congruences from an Open University booklet I found in the library.  John also submitted his most popular post of 2008 – Jenga Mathematics which is more than worthy of your attention.

If I stuck to tradition then that would be it for this edition of the carnival since they were the only submissions I received.  It seems that the festive period really isn’t a good time for getting responses from math bloggers!   So, I threw tradition out of the window and went looking for some of my favourite maths blog posts from the last 12 months.  The only rules I tried to stick to were ‘one post per blog and one post per month’.

1 year, 12 months, 12 posts, 12 blogs – Happy new year to you all.

January:  Mathematics is logical, elegant and refined.  The real world isn’t! Just like a street fight, the real world is dirty, surprising and uncompromising and solving real-world mathematical problems in physics and engineering can often take phenomenal amounts of computational power. Enter street-fighting mathematics, an MIT course that teaches you some of the tricks and techniques you’ll need in order to get approximate answers to many real-world problems in just a few lines of mathematics.  I first learned of this course from a blog post by Michael Lugo of God Plays Dice back in January and yet I still haven’t found time to work through it.  With luck, I’ll manage it in 2009.

February: I like mathematics that’s pretty and so does Vlad Alexeev – author of both Mathpaint and Impossible World.  Back in February he highlighted a sculpture of a three dimensional Hilbert curve by Carlo H. Séquin.  This post also includes an image rendered by a piece of software called Maxwell Renderer which looks intruging – can anyone suggest the closest open source equivalent?

March: Thanks to Easter, a lot of people went egg-crazy back in March and Kathryn Cramer of Wolfram Research was one of them.  In response to her initial post a lot of us attempted to create Mathematical easter eggs using Mathematica.

April: I have never taken a course in graph theory and so I don’t know much about it but I have attended talks on the subject and so have seen an old map of Königsberg several times.  Using googlemaps, the guys over at 360 showed that if we pose the Königsberg problem today then the result is completely different.

May:  If you read this blog for more than a couple of weeks then you will quickly realise that I like computer algebra systems and yet the free, open source pacakge Axiom is one that I haven’t played with much.  Alasdair of Alasdair’s Musings has though and he has also written a great 6-part introduction to the system which started in May.

June: No Carnival is complete without a puzzle to solve and Tanya Khovanova gave us a great one back in June.

July: Back in July, Eric Roland gave us details of his prime generating formula

August: Google isn’t just a search engine – it’s a calculator too but, like all calculators, it doesn’t always give the correct results.  Stephen Shankland gave us the details back in August.

September: Brian Hayes of bit-player invited us all to just shut up and program.  All too often I read articles from old-timers (such as myself – recently hitting 31) who lament about the loss of a supposedly golden age of computing.  You see, back in the 80s and early 90s we used computers such as the Sinclair Spectrum, Commodore 64, Acorn Archimedes and Amiga and all of them came with a programming language built in – usually some form of BASIC.  These old-timers argue that young-uns find it difficult to get into programming these days since computers no longer come with programming languages built in – or if they do then they are hidden from view in some way.

Of course this is a load of rubbish.  Hand me a computer with an internet connection and 60 seconds later I will hand it back to you with one or more programming environments installed that would be suitable for mathematical exploration (or mucking around as I prefer to think of it).  Brian’s article gives some ideas, both free and commercial, that might get you started.

October: Loren Shure of the Art of MATLAB explains how to create the Olympic rings using MATLAB.

November: What are p-adic numbers?  I have no idea – yet another subject that is on my list of subjects to study.  Dave Richeson of ‘Divison by Zero’ knows what they are though and gave a basic introduction to them back in November.  Thanks Dave – that post now represents the sum total of my knowledge on the subject.

December: Finally we reach December and a post from squareCircleZ who explains how Archimedes was doing calculus 2000 years before Newton and Leibniz.

So, that’s it.  The final carnival of mathematics for 2008.  I hope that no one minds the breaks from tradition and I hope you will join me in supporting the carnival throughout 2009.  Happy new year to you all

December 28th, 2008

This time last year I asked the question ‘What is interesting about the number 2008?‘ and it turned out to be rather popular so I thought I would do the same with 2009. Of course definitions of ‘interesting’ vary but for what what it is worth here are a few things that fit my definition of the term.

  • Both 2009 and its reversal 9002 are multiples of 7.
  • The 2009th prime (17471) is palindromic.
  • You can express 2009 as the sum of 4 positive cubes in exactly 3 ways. (Kudos to anyone who can come up with these 3 ways)

Non Mathematical fact about 2009: 2009 is a blue moon year.

Quiz: 2009 is (probably) the 44th term of a sequence that begins 1789, 1797, 1801, 1809. What is this sequence?

If you know of any mathematical reasons why 2009 might be considered as interesting then please let me know in the comments.

Update 31st Dec 2009: Thanks to the great site Number Gossip, I have discovered that

Oh dear, I fear that numerology cranks are going to have a field day.

December 27th, 2008

If you didn’t get around to submitting anything for the next carnival of maths then now is your chance! I’m delaying the publication until Monday so please post your submissions via the comments section.

December 27th, 2008

The guys at Blinkdagger put together a great MATLAB Christmas card for you all and sent it in to me as part of the Walking Randomly Christmas challenge.  I would have posted it earlier but I have been away from the Internet over Christmas (sorry Rob). Thanks guys!

MATLAB Christmas card

A brief explanation of the maths involved (from Rob of Blinkdagger)
– the snowdrifts are sine waves of different amplitudes and offsets
– the tree is a 3D spiral of green asterisks
– the ornaments are a random selection of the same points as the tree,
with different colors and marker types
– the presents under the tree are the trademark “membrane” surface that is the MATLAB logo.
– the star atop the tree, as well as the star in the sky are just single points graphed, but using the default marker types creatively
– the text is, well it’s just text

% Xmas card from for the challenge

%% setup the fig
h1 = figure(‘Position’,[50 50 800 600],’Color’,’w’);

%% Put background snowdrifts and star
axes(‘Position’,[0 0.5 1 .05]);
ezplot(‘sin(.1*x+1.8)’); axis off; title(”);

axes(‘Position’,[0 0.4 1 .1]);
ezplot(‘sin(.3*x)’); axis off; title(”);

axes(‘Position’,[0 0.25 1 .1]);
ezplot(‘sin(.4*x-1.5)’); axis off; title(”);

axes(‘Position’,[0 0.1 1 .15]);
ezplot(‘cos(.4*x-2)’); axis off; title(”);

axes(‘Position’,[0.75 0.75 0.2 0.2]);
plot(1,1,’x’,’markersize’,48,’markeredgecolor’,[.5 .5 .5]);
axis off; title(”); hold on;
plot(1,1,’h’,’markersize’,36,’markeredgecolor’,[.5 .5 .5]);
plot(1,1,’+’,’markersize’,80,’markeredgecolor’,[.5 .5 .5]);
hold off;

%% Put tree on and decorate it

axes(‘Position’,[0.55 0.2 0.4 0.6]);
z = 0:.05:100;
x = cos(z); x = (101-z).*x;
y = sin(z); y = (101-z).*y;
plot3(x,y,z,’g*’,’markersize’,18); axis off; view(0,10);
hold all;
% star on top
plot3(0,0,107,’p’,’markersize’,24,’markerfacecolor’,[1 .8431 0],…
% plot ornaments
k = rand(size(x));
k1 = k>.97;
k2 = k>.94 & k<.97;
k3 = k>.91 & k<.94;
k4 = k>.88 & k<.91;
k5 = k>.85 & k<.88;
k6 = k>.82 & k<.85;
plot3(x(k1),y(k1),z(k1),’ro’,’markersize’,8,’linewidth’,2); axis off; view(0,10);
plot3(x(k2),y(k2),z(k2),’ys’,’markersize’,8,’linewidth’,2); axis off; view(0,10);
plot3(x(k3),y(k3),z(k3),’md’,’markersize’,8,’linewidth’,2); axis off; view(0,10);
plot3(x(k4),y(k4),z(k4),’b^’,’markersize’,8,’linewidth’,2); axis off; view(0,10);
plot3(x(k5),y(k5),z(k5),’kh’,’markersize’,8,’linewidth’,2); axis off; view(0,10);
plot3(x(k6),y(k6),z(k6),’c*’,’markersize’,8,’linewidth’,2); axis off; view(0,10);

hold off;

%% Put presents under the tree
axes(‘Position’,[0.5 0.12 0.1 0.15]);
colormap(hot*.7); surf(membrane,membrane); shading flat; axis off; view(300,20);
axes(‘Position’,[0.57 0.1 0.1 0.15]);
surf(membrane); shading flat; axis off; view(300,20);
axes(‘Position’,[0.63 0.08 0.1 0.15]);
surf(membrane); shading flat; axis off; view(300,20);
axes(‘Position’,[0.7 0.08 0.1 0.15]);
surf(membrane); shading flat; axis off; view(300,20);
axes(‘Position’,[0.77 0.1 0.1 0.15]);
surf(membrane); shading flat; axis off; view(300,20);
axes(‘Position’,[0.83 0.13 0.1 0.15]);
surf(membrane); shading flat; axis off; view(300,20);

%% Overlay snowflakes

%% Text greeting

axes(‘Position’,[.05 .6 .5 .5]); axis off;
text(.08,.55,’Seasons Greetings!’,’fontsize’,30,’color’,’r’,…
text(.07,.31,’Best wishes and have a great 2009′,’fontsize’,20,…
‘color’,[0 .4 0],’fontname’,’Garamond’);
text(.07,.18,’solving problems with MATLAB!’,’fontsize’,20,…
‘color’,[0 .4 0],’fontname’,’Garamond’);
text(.07,.05,’From everyone at!’,’fontsize’,20,…
‘color’,[0 .4 0],’fontname’,’Garamond’);

December 23rd, 2008

The next Carnival of Mathematics will be hosted here on Sunday 28th Decemeber and so I am in need of submissions.  The usual carnival submission form has not been set up yet so you can either email me or post your submission(s) in the comments.  I will be supressing the publication of all comments to this post so it won’t spoil the show.

Since this carnival will be the last one in 2008 I thought I would change the format slightly and ask for not only your most recent mathematical posts but also your favourite posts from the previous 12 months.  Also, feel free to nominate other people’s articles that you particularly enjoyed over the past year (but please make it clear to me that this is what you are doing).

Let’s try and make this one the Carnival of the year!

December 18th, 2008

As we get closer and closer to the holiday season I am finding it increasingly difficult to focus on anything productive. Here are a couple of silly links to help bring your productivity levels down to mine.

What do you plan on sending your true love this Christmas? Whether it’s a partridge in a pear tree or five gold rings, the credit crunch affects them all – see how in  True loves to face most expensive Christmas ever.

If programming languages were religions then what would they be?  Apparently Perl would be voodoo and having used Perl for a number of years I would have to agree :)  Comparing Visual Basic to Satanism might be a little harsh though.  I wonder what Mathematica or MATLAB would be?

December 18th, 2008

After realising that my shiny new Dell XPS M1330 could make use of CUDA I had a bash at installing it on Intrepid.  The notes at the following link were very useful but I did not follow them to the letter.  I can’t remember what changes I made but it was all minor stuff.

When I tried to compile the examples that are included in the SDK I got many many errors – some of which included

In file included from src/cmd_arg_reader.cpp:33:
./../common/inc/cmd_arg_reader.h: In member function ‘const T* CmdArgReader::getArgHelper(const std::string&)’:
./../common/inc/cmd_arg_reader.h:416: error: must #include before using typeid
./../common/inc/cmd_arg_reader.h:432: error: must #include before using typeid
src/cmd_arg_reader.cpp: In destructor ‘CmdArgReader::~CmdArgReader()’:
src/cmd_arg_reader.cpp:101: error: must #include before using typeid

A bit of googling helped me determine that these errors were caused by the fact that 8.10 of Ubuntu uses a version of gcc that is currently unsupported by CUDA. The following commands fixed that by changing the default compiler to gcc-4.1

sudo apt-get install build-essential libglut3-dev gcc-4.1 g++-4.1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.1

Some other things I did may have helped but it was the two lines above that fixed the problem for me

December 17th, 2008

The Wolfram Demonstrations project has been updated to take advantage of the new features of version 7 of Mathematica and Jeff Bryant has written a great post about it on the Wolfram Research Blog.  As you might expect, Wolfram have also upgraded their free Mathematica player which allows you to run all of their demonstrations without a Mathematica license.

Some of the new demonstrations are very pretty!  I particularly like their new vector field plotting routines as shown in the demonstration below which calculates the electric field pattern formed by three point charges.

Electric field of 3 point charges

The new image processing routines that Wolfram have added to Mathematica allow for the easy production of some very beautiful demonstrations.  Here is one by Peter Overmann that simulates a photographic technique called the Orton Effect.

The Orton Effect

December 15th, 2008

Back in February I blogged about a little Mathematica demonstration I wrote which plotted several heart shaped algebraic surfaces. One or two people wrote in the comments section asking how to do such plots in MATLAB and I thought that it was about time I came up with the code.

%code to plot a heart shape in MATLAB
%set up mesh
%Compute function at every point in mesh
F=320 * ((-X.^2 .* Z.^3 -9.*Y.^2.*Z.^3/80) + (X.^2 + 9.* Y.^2/4 + Z.^2-1).^3);
%generate plot
view([-67.5 2]);

It’s not really the right time of year for hearts though is it? So let’s plot a star instead.


%Code to plot a 3D star in MATLAB
%set up mesh
%Compute function at every point in mesh
%generate plot
axis off;
view([-48 18]);

For more examples of algebraic surfaces see the Algebraic Surfaces Gallery.

December 12th, 2008

David Joyner of the SAGE development team has come up with a couple of very nice mathematical Christmas greetings using a combination of SAGE (For the mathematics used to generate the images) and GIMP and Inkscape (for the text).  The first one is based on a Barnsley Fractal and the sage source code is available here.

small fern

David’s other creation is a Sierpinski gasket that has been coloured such that it resembles a Christmas tree.  The SAGE source code is given below.


def sierpinski_seasons_greetings():
Code by Marshall Hampton.
Colors by David Joyner.
General depth by Rob Beezer.
Copyright Marshall Hampton 2008, licensed
creative commons, attribution share-alike.
depth = 7
nsq = RR(3^(1/2))/2.0
tlist_old = [[[-1/2.0,0.0],[1/2.0,0.0],[0.0,nsq]]]
tlist_new = [x for x in tlist_old]
for ind in range(depth):
for tri in tlist_old:
for p in tri:
new_tri = [[(p[0]+x[0])/2.0, (p[1]+x[1])/2.0] for x in tri]
tlist_old = [x for x in tlist_new]
T = tlist_old
N = 4^depth
N1 = N - 3^depth
q1 = sum([line(T[i]+[T[i][0]], rgbcolor = (0,1,0)) for i in range(N1)])
q2 = sum([line(T[i]+[T[i][0]], rgbcolor = (1,0,0)) for i in range(N1,N)])
show(q2+q1, figsize = [6,6*nsq], axes = False)

It just goes to show that advanced mathematical software such as SAGE doesn’t just have to be used for teaching and research – it can be used for making mathematical Christmas cards too! SAGE is completely free and is available from the SAGE math website. Thanks to David for his work on this one.