## Mathematical Christmas Cards – Walking Randomly Christmas Challenge

November 30th, 2008 | Categories: general math | Tags:

Now that December has arrived you may well be thinking of sending your loved ones a Christmas card so why not send them one based on some sort of Mathematics? Even better – why not design it yourself? Software packages such as Mathematica, SAGE and MATLAB are absolutely perfect for this sort of thing since they combine a large amount of mathematical functionality with top quality plotting routines. To see what I mean – let’s take a look at a Christmas greeting designed by the developers of the open source mathematical system, SAGE.

I have to confess that I do not have a clue about the mathematics behind the above greeting (something to do with a p-adic plot function apparently) but maybe by the time Christmas comes around I will understand how it was created. The SAGE source code you need to generate it is

 sage: P1 = Zp(3).plot(rgbcolor=(0,1,0)) sage: P2 = Zp(7).plot(rgbcolor=(1,0,0)) sage: P3 = text("$Seasons$ $Greetings$ ",(0.0,1.8)) sage: P4 = text("$from$ $everyone$ $at$ sagemath.org!",(0.1,-1.6)) sage: (P1+P2+P3+P4).show(axes=False)

I thought I would have at doing one and came up with the design below by re-using some Mathematica code from a Wolfram Demonstration. The design is based on a fractal called the Koch Snowflake.

 Koch[0] = {{0, 0}, {1, 0}, {1/2, -(Sqrt[3]/2)}, {0, 0}} // N; Koch[n_] := Koch[n] = Module[{s}, Partition[Koch[n - Sign[n]], 2, 1] /. {a_, b_} :> (s = b - a; {a, a + s/3, a + s/3 + RotationTransform[Sign[n] 60 °][s/3],a + 2 s/3})] // Append[Flatten[#, 1], Last[Koch[n - Sign[n]]]] &; Graphics[Line@Koch[5], Epilog -> Inset[Style["Merry Christmas", 20], {Center, Center}, {Center,Center}]] 

OK, so it’s clear that I am no designer but how often do you get a Christmas card that comes complete with Source code? This got me thinking, there must be people out there with better design skills than me – a great many of them in fact and so onto the challenge.

Your task is to design a Christmas message with a mathematical theme using any mathematical system or programming language of your choice. Your design must be generated algorithmically (so you can’t design it in Photoshop and import it into Mathematica for example) and it must include source code. Ideally, you should include a quick explanation of the mathematics you featured in your design.

There will be no prizes I’m afraid other than kudos and praise from me but hopefully you’ll have fun doing it just the same. You can get your designs to me in a number of ways: email me, post source code in the comments section or post your design on your own website and send me the link – whatever you feel is best.

If you do not have access to a commercial maths package such as Mathematica, MAPLE or MATLAB then I suggest that you take a look at SAGE which is completely free (in fact you should take a look at SAGE even if you DO have one of the commercial systems).

Assuming some people actually respond to this post, I will post some of my favourites over the run up to Christmas.

Have fun!