WOLFRAM

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

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.
Products

Mathematica Q&A: Three Functions for Computing Derivatives

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 Bashir, a student: What are the different functions for computing derivatives in Mathematica? The main function for computing derivatives in Mathematica is D, which computes the familiar partial derivative of an expression with respect to a variable: D supports generalizations including multiple derivatives and derivatives with respect to multiple variables, such as differentiating twice with respect to x, then once with respect to y: And vector and tensor derivatives, such as the gradient:
Leading Edge

Former Microsoft CTO Uses Mathematica to Explore the Science of Modernist Cuisine

Ever wondered how to grill the perfect steak? Or how well dunking food into an ice bath stops the cooking process? Nathan Myhrvold used Mathematica to answer these questions, and many others. Myhrvold, the first chief technology officer at Microsoft, has had a longtime interest in cooking and has a background in science and technology. When he started using new techniques like sous vide, in which food is slowly cooked in vacuum-sealed bags in water at low temperature, he discovered that many chefs don't know much about the science behind cooking. He decided to change that with a massive cookbook that was released in March. In 2,438 pages, Modernist Cuisine covers a wide range of cooking techniques and their scientific backgrounds, including heat transfer and the growth of pathogens. (It has recipes, too.)
Announcements & Events

A New Mathematica Tip Every Day on Twitter

We're excited to announce a new Twitter feed for bite-sized Mathematica hints and tips:

@MathematicaTip

Starting today, we're tweeting a new Mathematica tip every day, Monday through Friday. We'll cover everything from Mathematica features and graphics to user interface tips and keyboard shortcuts to miscellaneous fun examples. Follow the new feed on Twitter at @MathematicaTip. Tweet your own favorite hints or questions to us at @MathematicaTip.
Products

Mathematica Q&A: Four Ways to Sum Integer Digit Blocks

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 Craig, a hobbyist: For each six-digit number in a list, how can I check whether the sums of the first and last three digits are equal? For example, the sums of the first and last three digits of the number 123,222 are equal because 1 + 2 + 3 == 2 + 2 + 2. There are several different ways of solving this straightforward programming problem in Mathematica, and it's instructive to compare them. In this post you'll see four methods demonstrating various combinations of built-in Mathematica functions for working with lists and digits of integers.
Products

And the Winners Are…

The Wolfram Demonstrations Challenge has run its course, and you have participated in droves. It's time to pick the winners. We do things our own way at Wolfram Research. We don't pull slips of paper from a hat or ping-pong balls from a barrel for prize drawings. We write Mathematica programs to tell us who the winners are. Of course. I wrote the program, but not wanting to expose myself to accusations of improperly influencing my laptop, I didn't run it myself. Stephen Wolfram did and sent me the results. And the winners are...
Products

Mathematica Q&A: Sow, Reap, and Parallel Programming

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 Patrick, a student: How can I use Sow & Reap across parallel kernels? Before we answer this question, a review of the useful functions Sow and Reap is in order. Sow and Reap are used together to build up a list of results during a computation. Sow[expr] puts expr aside to be collected later. Reap collects these and returns a list: The first part of the list is the regular result of the computation. The second part is everything that was “sown”. Sow and Reap are ideally suited to situations in which you don't know in advance how many results you will get. For example, suppose that you want to find simple initial conditions that lead to "interesting" results in Conway's game of life, the famous two-dimensional cellular automaton: