[insert witty title]

Calm down. It’s only ones and zeros.

Entries Comments



Category: Mathematics


Holy Crap This is Incredible

28 December, 2007 (23:31) | Mathematics | By: cmb

It turns out there is a formula that can calculate the nth digit of pi without needing to know the previous n-1 digits!

bbp.png

Wikipedia has a comprehensive page on the so called Bailey-Borwein-Plouffe formula,

A Numerical Miracle

22 March, 2007 (15:30) | Mathematics | By: cmb

I read today about possibly the best mathematical formula, ever. Tupper’s Self Referential Formula. It looks like this:

[tex="Tuppers Self Referential Formula"]\frac{1}{2}\le\lfloor{\rm mod}\Big(\lfloor\frac{y}{17}\rfloor2^{-17\lfloor x\rfloor-{\rm mod}(\lfloor y \rfloor,17)},2\Big)\rfloor,[/tex]

where the notation [tex="floor"]\lfloor x \rfloor[/tex] is the floor operator (round the number down to the nearest integer). If this inequality is plotted in the range [tex="xrange"]0\le x \le 108[/tex] and [tex="yrange"]n \le y \le n+17[/tex] (where n is some constant) then it draws a picture of itself!


The value of n needed to make the picture above is:

96093937991895888497167296212785275471500433966012930665150
55192717028023952664246896428421743507181212671537827706233
55993237280874144307891325963941337723487857735749823926629
71551717371699516523289053822161240323885586618401323558513
60488286933379024914542292886670810961844960917051834540678

27731551705405381627380967602565625016981482083418783163849
11559022561000365235137034387446184837873723819822484986346
50331594100549747005931383392264972494617515457283667023697
45461014655997933798537483143786841806593422227898388722980
000748404719

Isn’t that cool? If you don’t believe me then try it for yourself! Some kind soul has written a Java applet that performs the calculation here

(via Proceedings of the Athanasius Kircher Society)

p.s. as you can probably tell I have fixed the LaTeX renderer on the blog

On the Futility of Betting Systems

6 February, 2007 (22:55) | Mathematics | By: cmb

(Thanks to RKM for the idea!)

It sometimes seems that you can’t move online for flashing banners promising $$$ EASY ONLINE 24/7 GAMBLING! $$$ and wherever casino adverts are found you can be sure that tagging along somewhere is their counterpart, the ‘beat the system’ advert. Packed full of crazy testimonials and wild claims about the efficacy of their product they make for some really interesting reading:

” I go now a couple of days a week to Atlantic City and always come back with at least $2000-$3000 grand. Thanks!!!! “

“I’m about to show you how you can make an easy $200 free within the next hour and atleast $200 every day without risking any of your own money. “

” Not many people know how to use the roulette properly. Most of them are certain it is merely a game of luck. In BettingAnalytics we have a whole new division of professional gamblers called BettingAnalytips which specializes in what we like to call, “putting the order back into chaos”: Don’t count on luck, count on systems!”

“IF YOU ORDER TODAY THE PRICE WILL ONLY BE $47!”

Each of these quotes was taken from a random site found by typing ‘how to win at roulette’ into Google. The information being offered for sale by pretty much every single one of these sites can be classified under one of three headings. Let’s take a look at each in turn:

Betting Systems

Every single casino game has a ‘house edge’. That is, on any given spin of the wheel, deal of the cards or flip of the coins the probability of you winning is slightly less than 50%. In the long run the casino is therefore guaranteed to take all of your money. In the short term, however, you may experience large positive and negatie bankroll fluctuations.

Betting systems are methods of altering your betting patterns such that (they claim) you are guaranteed to make money from the casino. Well known betting systems include the Martingale and the D’Alembert system. No such strategy can beat the house edge in the long run, and all of them trade off many small wins for a big loss or vice versa.

The Wizard of Odds has performed a most convincing demonstration that no betting system can possibly work, and in addition has a challenge where he offers to give $2,000 to anybody who could prove otherwise. In summary:

No matter what betting system you apply, you lose exactly as much money as would be predicted by simple calculations taking into account the house edge in the game

Casino Bonus Whoring

This one actually works, at least for a short while.

To attract new players, most online casinos will offer bonus money with an initial deposit. For example, if you deposit $100 some places will match you 100% which gives you $100 extra so you’ll have $200 in your casino account to gamble with. To make it so that you don’t just deposit money then cash out and leave the casinos they add a wage requirement (WR). A WR is simply how many times the amount of the deposit and/or the bonus you have wager before you can withdraw. Lets say the casino asks for a 8x WR, if you deposited $100 and they gave you a $100 match bonus, you’d have to gamble $1600 before you can cash out your money.

So you have $200 and you have to gamble $1600, which sounds pretty worthless right? It is, unless you play blackjack. For simplicity’s sake let’s say the odds of blackjack are 49% in your favor and 51% in the houses. Your objective is to break even or close to it. If you play blackjack and bet $1 per hand, statistically, you are going to be a little under from what you started at. So lets say you started with $200, gambled $1600, finished with $175, you’d make $75 profit. Then you’d hit other casinos and do the same thing making more and more money.

There are some very comprehensive guides to casino whoring on the internet, and the ideal strategy tables from the Wizard of Odds ensure that the house edge is kept to an absolute minimum. It is easy to make around $700-1000 from bonus whoring at very low risk to yourself. But beyond that you begin to run out of sites with bonuses on offer.

The ‘beat the casino’ sites make money either by (a)Selling you an overpriced eBook, or (b)Earning signup bonuses from the casinos.

Blackjack Card Counting

I’m not going to spend long on this one because everybody knows what it is, the Wikipedia article is very informative. In summary card counting is:

1. Bloody hard to learn how to do
2. virtually impossible in a casino because the large number of simultaneous decks in play make it so that statistical deviations in the number of high and low cards in the pile are very small.
3. totally impossible online because the cards are reshuffled by computer after every single hand
4. will get you kicked out of casinos.

In summary: You can’t beat the casinos at table games unless you invent some sort of laser roulette ball tracker.

—–

Mandelbrot Madness!

17 April, 2006 (22:45) | Mathematics | By: cmb

I like fractals. Complexity arising from simple mathematics and all that. This is my blog and I can ramble on about whatever I want so lets talk about fractals today, or rather one fractal in particular.

Pick a complex number z0. Repeatedly run this number through the transform zi+1=zi2+z0. You’ll find that for some choices of z0 this number runs off to infinity, for others it will spiral and shoot around, but never get very large. If you colour in spots on an Argand diagram for which this number never gets large then you get the following picture:

That’s right! It’s your friend and mine Mr. Mandelbrot. The set that contains all of the complex numbers for which zi+1 = zi2+z0 never goes to infinity.

So far so good, it’s nothing you haven’t seen before.

Now, I found a while ago about a more interesting way to plot this. The traditional way of viewing the Mandelbrot set immediately discards any points that run off to infinity, but what do they do before they get there? do they shoot straight off, or do they spiral around, gradually moving out.

Well lets have a look, here I plotted out the paths of every point that ends up going to infinity. The brightness of each pixel represents the number of times it was hit.


click for full image

Isn’t it pretty! This way of plotting the Mandelbrot set is called the Buddhabrot. (IDL or MPI FORTRAN code available upon request)

—–

Infinity is Quite Big

14 April, 2006 (12:04) | Mathematics | By: cmb

A while back I got into a discussion about how many possible photographs there are. This is obviously a completely absurd question to ask, and the answer is that there are an infinite number. So lets turn the problem into something more tractable:

How many 50×50 pixel greyscale images (counting 256 different shades of grey) could possibly exist?

The answer is easily computable and is 256^(50*50), or about 10^6020, or more precisely (clicky for big number). This is an absolutely overwhelming number and we can’t really do anything interesting with it.

How about, though, if we imagine a camera with only two colours: black and white. Furthermore this crap camera (or CrapCamTM) can only take pictures of size 5*4 pixels. How many possible images could it capture? Once again this isn’t hard to calculate and the answer is 2^(5*4), or 1048576.

Well, what with me having far too much spare time, I went out and took every single possible photograph from our CrapCamTM, and then mirror imaged them so they look like space invaders. Here are one million space invaders (beware, web browser destroying 6.8Mb png lies beyond that link), here is a tiny fraction of that image:

No repeats, nothing missing, this is every image that could possibly be taken from our hypothetical camera.

It’s interesting to think that with a well written computer program and an infinite amount of time we could generate every possible image. Including an image of me fighting a grizzly bear, but the bear has a toaster for a head, and I am only three inches high. Also I have an afro.

The infinite photograph project would be worth the infinite amount of computer time it requires for that picture alone.

—–