Browse by Topic

# Date Archive: 2011 June

Computation & Analysis

## All Rational Approximations of Pi Are Useless

When I first learned about π, I was told that a good approximation was 22/7. Even when I was 12 years old, I thought this was utterly pointless. 22/7 agrees with π to two decimal places (so three matching digits): Since there are three digits to remember in 22 and 7, what have you gained? You have just as much to remember, but have lost the notion that π is “just over 3”. Is there a better rational approximation where we actually get out more digits than we put in? Here is a brief and rather low-brow investigation (and the chance to win something if you can do better).
Design & Visualization

## Mission Mathematica: Making a Photo Booth App in Three Steps

Creating an interactive app could be a complex and painstaking task. Not with Mathematica. Here I will present how I created a photo booth program in three easy steps—mostly during my lunch breaks. Step One: Architecture The application will have four main stages. Stage one: We show live webcam images with different image effects applied (possibly multiple pages of them) as a preview, and let the user choose one. Stage two: The chosen image takes up the window, waiting for the user to click a button. Stage three: Count down. Stage four: Capture an image, apply the effect, and add it in a film strip. Repeat.
Products

## Mathematica Q&A: Computing Freight-Container Check Digits

Got questions about Mathematica? The Wolfram Blog has answers! We'll regularly answer selected questions from users around the web. You can submit your question directly to the Q&A Team using this form. This week's question comes from Adri, an engineer: How can I calculate the check digit in freight container codes like MSKU3881107? We had to start with some quick research for this question: it turns out that freight (shipping) container identification is covered by the ISO 6346 standard (Wikipedia). Under ISO 6346, each container is labeled with an 11-digit code (four letters + seven numerals) in which the last digit is a "check" digit that is computed from the other 10 digits, according to a fixed rule. For example, in MSKU3881107, the final “7” is the check digit. The rule specified by ISO 6346 for computing the check digit is designed so most accidental changes or misreadings of a single digit in a code will also change the check digit. This means you can use the check digit to catch most such errors; whenever you see a code, you calculate the check digit yourself and see if it matches up with the one in the code.
Best of Blog

## What Shall We Do with the Drunken Sailor? Make Him Walk the Plank!

Back in 1988 when Mathematica was just a year old and no one in my university had heard of it, I was forced to learn Fortran. My end-of-term project was this problem: "A drunken sailor returns to his ship via a plank 15 paces long and 7 paces wide. With each step he has an equal chance of stepping forward, left, right, or standing still. What is the probability that he returns safely to his ship?" I wrote a page or so of ugly code, passed the course, and never wrote Fortran again. Today I thought I would revisit the problem. We can code the logic of the sailor's walk quite easily using separate rules for each case. Firstly, if he is ever on the 16th step or already on the ship, then he is safely on the ship the next time.
Best of Blog