WOLFRAM

Recreational Computation

Computation & Analysis

11/11/11 11:11:11—The Right Time to Look at a Number

World War I officially ended in 1918 at the 11th hour of the 11th day of the 11th month. Remembrance Day is observed in Commonwealth countries to recall the end of the war and to remember the members of the armed forces who gave their lives for the cause. This year we observe Remembrance Day on 11/11/11. Beyond the somberness of this memorial day, those of us who are mathematically inclined consider the surprising ways we can combine 1s to achieve beautiful results. Some of these combinations involve rather unpleasant calculations, so we'll let Mathematica do the heavy lifting while we marvel at the results! Today I'll share 11 interesting places in which 1 appears. Let's jump in. 1. Can anything of interest come from combining the humble digit 1 with the square root and plus symbol? As the demonstration below suggests, given the right nesting, you get an infinite series that converges to φ = 1.61803..., the golden ratio.
Computation & Analysis

Industrial Pumpkin Carving with Mathematica

The art of pumpkin carving is hard to master, yet once a year parents in many countries are asked to perform this traditional and messy form of art. It's time for a change in this old tradition. In fact, our colleague Jon McLoone already made a significant advance in pumpkin carving, mainly using implicit functions and RegionPlot3D. This year, I decided to make a contribution of my own that is more interactive and easier to use, with Mathematica or Mathematica Home Edition, of course. Let's start with a list. These are the things you need for traditional pumpkin carving. A nice looking pumpkin Carving tools of your choice: from a spoon and knife (if you are a true professional) to an industrial 36,000 rpm power rotary tool (seriously, I know someone who uses one) A bunch of candles to be placed inside the pumpkin A pattern for the carving on paper For industrial Mathematica pumpkin carving, you need these tools. B-spline curve, surface, and function Color processing functions Morphological image processing functions ParametricPlot3D with Texture A pattern for the carving as a bitmap Intrigued? Let us begin.
Computation & Analysis

From Pi to Puzzles

Neil Bickford calculated the first 458 million terms for the continued fraction of pi, breaking the previous record of 180 million. He used Mathematica to develop his code and verify his results—which he posted shortly after he turned 13.

Bickford, who broke the record last fall, said creating the early version of the pi continued-fraction generator was “the best thing I’ve ever used Mathematica for.”

Best of Blog

How I Made Wine Glasses from Sunflowers

Eons ago, plants worked out the secret of arranging equal-size seeds in an ever-expanding pattern around a central point so that regardless of the size of the arrangement, the seeds pack evenly. The sunflower is a well-known example of such a "spiral phyllotaxis" pattern: It's really magical that this works at all, since the spatial relationship of each seed to its neighbors is unique, changing constantly as the pattern expands outwardly—unlike, say, the cells in a honeycomb, which are all equivalent. I wondered if the same magic could be applied to surfaces that are not flat, like spheres, toruses, or wine glasses. It's an interesting question from an aesthetic point of view, but also a practical one: the answer has applications in space exploration and modern architecture.
Computation & Analysis

Celebrating the Fourth of July with Mathematica Fireworks

What could be a better way to celebrate the Fourth of July than beautiful fireworks in the dark sky? And what could be a better way to create fireworks on your screen than using Mathematica? There are a few different ways to create firework "effects" on computers, but it would be a shame if we chose to use just graphical effects with Mathematica. Yes, we are going for the full-scale particle simulation. Here is the synopsis. We create a firework simulation. With a mouse click, we seed a number of particles on the screen. Each particle has a different initial velocity, and it will follow the projectile motion. The particles spend a limited time on the screen, in which their opacity will diminish gradually. There will be a few customizable effects—colors and trails.
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).
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

Test Your “Subitizing” Ability

Recently I found myself reading about “subitizing”, which is the process of instinctively counting small sets of items in a fraction of second. For example, try quickly counting a few of these: The Wikipedia article indicates that you can nearly always correctly count four or fewer items in a small fraction of a second. Above four, you start to make mistakes. I wanted to test this claim in Mathematica (using myself as the test subject). I decided to create a simple game in which small groups of items are momentarily displayed on the screen, after which players estimate how many they saw.
Computation & Analysis

The Mathematica One-Liner Competition

Your assignment: Write a simulation of spherical particles coalescing under gravitational attraction. Limit the approach distance by a secondary repulsive force that acts over short distances. Produce an animation of the dynamic system starting with 15 particles in randomized positions. Formulate your solution in 140 characters or less. Sound challenging? A 138-character solution was Stephan Leibbrandt's winning entry in the Mathematica One-Liner Competition that was a part of this year's Wolfram Technology Conference.