## The Summer 2017 Mathematics A To Z: Quasirandom numbers

Gaurish, host of, For the love of Mathematics, gives me the excuse to talk about amusement parks. You may want to brace yourself. Yes, this essay includes a picture. It would have included a video if I had enough WordPress privileges for that.

# Quasirandom numbers.

Think of a merry-go-round. Or carousel, if you prefer. I will venture a guess. You might like merry-go-rounds. They’re beautiful. They can evoke happy thoughts of childhood when they were a big ride it was safe to go on. But they don’t often make one think of thrills.. They’re generally sedate things. They don’t need to be. There’s no great secret to making a carousel a thrill ride. They knew it a century ago, when all the great American carousels were carved. It’s simple. Make the thing spin fast enough, at the five or six rotations per minute the ride was made for. There are places that do this yet. There’s the Cedar Downs ride at Cedar Point, Sandusky, Ohio. There’s the antique carousel at Crossroads Village, a historical village/park just outside Flint, Michigan. There’s the Derby Racer at Playland in Rye, New York. There’s the carousel in the Merry-Go-Round Museum in Sandusky, Ohio. Any of them are great rides. Two of them have a special edge. I’ll come back to them.

Randomness is a valuable resource. We know it’s key to many things. We have major fields of mathematics built on it. We can understand the behavior of variables without ever knowing what value they have. All we need is to know than the chance they might be in some particular range. This makes possible all kinds of problems too complicated to do otherwise. We know it’s critical. Quantum mechanics would not work without randomness. Without quantum mechanics, matter doesn’t work. And that’s true randomness, the kind where something is unpredictable. It’s not the kind of randomness we talk about when we ask, say, what’s the chance someone was born on a Tuesday. That’s mere hidden information: if we knew the month and date and year of a person’s birth we would know whether they were born Tuesday or not. We need more.

So the trouble is actually getting a random number. Well, a sequence of randomly drawn numbers. We rarely need this if we’re doing analysis. We can understand how some process changes the shape of a distribution without ever using the distribution. We can take derivatives of a function without ever evaluating the original function, after all.

But we do need randomly drawn numbers. We do too much numerical work with them. For example, it’s impossible to exactly integrate most functions. Numerical methods can take a ferociously long time to evaluate. A family of methods called Monte Carlo rely on randomly-drawn values to estimate the integral. The results are strikingly good for the work required. But they must have random numbers. The name “Monte Carlo” is not some cryptic code. It is an expression of how randomly drawn numbers make the tool work.

It’s hard to get random numbers. Consider: we can’t write an algorithm to do it. If we were to write one, then we’d be able to predict that the sequence of numbers was. We have some recourse. We could set up instruments to rely on the randomness that seems to be in the world. Thermal fluctuations, for example, created by processes outside any computer’s control, can give us a pleasant dose of randomness. If we need higher-quality random numbers than that we can go to exotic equipment. Geiger counters watching the decay of a not-alarmingly-radioactive sample. Cosmic ray detectors watching the sky.

Or we can write something that produces numbers that look random enough. They won’t really be random, and if we wait long enough we’ll notice the sequence repeats itself. But if we only need, say, ten numbers, who cares if the sequence will repeat after ten million numbers? (We’ll surely need more than ten numbers. But we can postpone the repetition until we’ve drawn far more than ten million numbers.)

Two of the carousels I’ve mentioned have an astounding property. The horses in a file move. I mean, relative to each other. Some horse will start the race in front of its neighbors; some will start behind. The four move forward and back thanks to a mechanism of, I am assured, staggering complexity. There are only three carousels in the world that have it. There’s Cedar Downs at Cedar Point in Sandusky, Ohio; the Racing Downs at Playland in Rye, New York; and the Derby Racer at Blackpool Pleasure Beach in Blackpool, England. The mechanism in Blackpool’s hasn’t operated in years. The one at Playland’s had not run in years, but was restored for the 2017 season. My love and I made a trip specifically to ride that. (You may have heard of a fire at the carousel in Playland this summer. This was of part of the building for their other, non-racing, antique carousel. My last information was that the carousel itself was all right.)

These racing derbies have the horses in a file move forward and back in a “random” way. It’s not truly random. If you knew exactly which gears were underneath each horse, and where in their rotations they were, you could say which horse was about to gain on its partners and which was about to fall back. But all that is concealed from the rider. The horse patterns will eventually, someday, repeat. If the gear cycles aren’t interrupted by maintenance or malfunctions. But nobody’s going to ride any horse long enough to notice. We have in these rides a randomness as good as what your computer makes, at least for the purpose it serves.

What does it mean to look random? Some things seem obvious. All the possible numbers ought to come up, sooner or later. Any particular possible number shouldn’t repeat too often. Any particular possible number shouldn’t go too long without repeating. There shouldn’t be clumps of numbers; if, say, ‘4’ turns up, we shouldn’t see ‘5’ turn up right away all the time.

We can make the idea of “looking” random quite literal. Suppose we’re selecting numbers from 0 through 9. We can draw the random numbers we’ve picked. Use the numbers as coordinates. Say we pick four digits: 1, 3, 9, and 0. Then draw the point that’s at x-coordinate 13, y-coordinate 90. Then the next four digits. Let’s say they’re 4, 2, 3, and 8. Then draw the point that’s at x-coordinate 42, y-coordinate 38. And repeat. What will this look like?

If it clumps up, we probably don’t have good random numbers. If we see lines that points collect along, or avoid, there’s a good chance our numbers aren’t very random. If there’s whole blocks of space that they occupy, and others they avoid, we may have a defective source of random numbers. We should expect the points to cover a space pretty uniformly. (There are more rigorous, logically sound, methods. The eye can be fooled easily enough. But it’s the same principle. We have some test that notices clumps and gaps.) But …

The thing is, there’s always going to be some clumps. There’ll always be some gaps. Part of randomness is that it forms patterns, or at least things that look like patterns to us. We can describe how big a clump (or gap; it’s the same thing, really) is for any particular quantity of randomly drawn numbers. If we see clumps bigger than that we can throw out the numbers as suspect. But … still …

Toss a coin fairly twenty times, and there’s no reason it can’t turn up tails sixteen times. This doesn’t happen often, but it will happen sometimes. Just luck. This surplus of tails should evaporate as we take more tosses. That is, we most likely won’t see 160 tails out of 200 tosses. We certainly will not see 1,600 tails out of 2,000 tosses. We know this as the Law of Large Numbers. Wait long enough and weird fluctuations will average out.

What if we don’t have time, though? For coin-tossing that’s silly; of course we have time. But for Monte Carlo integration? It could take too long to be confident we haven’t got too-large gaps or too-tight clusters.

This is why we take quasi-random numbers. We begin with what randomness we’re able to manage. But we massage it. Imagine our coins example. Suppose after ten fair tosses we noticed there had been eight tails turn up. Then we would start tossing less fairly, trying to make heads more common. We would be happier if there were 12 rather than 16 tails after twenty tosses.

Draw the results. We get now a pattern that looks still like randomness. But it’s a finer sorting; it looks like static tidied up some. The quasi-random numbers are not properly random. Knowing that, say, the last several numbers were odd means the next one is more likely to be even, the Gambler’s Fallacy put to work. But in aggregate, we trust, we’ll be able to enjoy the speed and power of randomly-drawn numbers. It shows its strengths when we don’t know just how finely we must sample a range of numbers to get good, reliable results.

To carousels. I don’t know whether the derby racers have quasirandom outcomes. I would find believable someone telling me that all the possible orderings of the four horses in any file are equally likely. To know would demand detailed knowledge of how the gearing works, though. Also probably simulations of how the system would work if it ran long enough. It might be easier to watch the ride for a couple of days and keep track of the outcomes. If someone wants to sponsor me doing a month-long research expedition to Cedar Point, drop me a note. Or just pay for my season pass. You folks would do that for me, wouldn’t you? Thanks.

## Reading the Comics, July 28, 2014: Homework in an Amusement Park Edition

I don’t think my standards for mathematics content in comic strips are seriously lowering, but the strips do seem to be coming pretty often for the summer break. I admit I’m including one of these strips just because it lets me talk about something I saw at an amusement park, though. I have my weaknesses.

Harley Schwadron’s 9 to 5 (July 25) builds its joke around the ambiguity of saying a salary is six (or some other number) of figures, if you don’t specify what side of the decimal they’re on. That’s an ordinary enough gag, although the size of a number can itself be an interesting thing to know. The number of digits it takes to write a number down corresponds, roughly, with the logarithm of a number, and in the olden days a lot of computations depended on logarithms: multiplying two numbers is equivalent to adding their logarithms; dividing two numbers, subtracting their logarithms. And addition and subtraction are normally easier than multiplication and division. Similarly, raising one number to a power becomes multiplying one number by the logarithm of another, and multiplication is easier than exponentiation. So counting the number of digits in a number might be something anyway.

Steve Breen and Mike Thompson’s Grand Avenue (July 25) has the kids mention something as being “like going to an amusement park to do math homework”, which gives me a chance to share this incident. Last year my love and I were in the Cedar Point amusement park (in Sandusky, Ohio), and went to the coffee shop. We saw one guy sitting at a counter, with his laptop and a bunch of papers sprawled out, looking pretty much like we do when we’re grading papers, and we thought initially that it was so very sad that someone would be so busy at work that (we presumed) he couldn’t even really participate in the family expedition to the amusement park.

And then we remembered: not everybody lives a couple hours away from an amusement park. If we lived, say, fifteen minutes from a park we had season passes to, we’d certainly at least sometimes take our grading work to the park, so we could get it done in an environment we liked and reward ourselves for getting done with a couple roller coasters and maybe the Cedar Downs carousel (which is worth an entry around these parts anyway). To grade, anyway; I’d never have the courage to bring my laptop to the coffee shop. So I guess all I’m saying is, I have a context in which yes, I could imagine going to an amusement park to grade math homework at least.

Wulff and Morgenthaler Truth Facts (July 25) makes a Venn diagram joke in service of asserting that only people who don’t understand statistics would play the lottery. This is an understandable attitude of Wulff and Morgenthaler, and of many, many people who make the same claim. The expectation value — the amount you expect to win some amount, times the probability you will win that amount, minus the cost of the ticket — is negative for all but the most extremely oversized lottery payouts, and the most extremely oversized lottery payouts still give you odds of winning so tiny that you really aren’t hurting your chances by not buying a ticket. However, the smugness behind the attitude bothers me — I’m generally bothered by smugness — and jokes like this one contain the assumption that the only sensible way to live is a ruthless profit-and-loss calculation to life that even Jeremy Bentham might say is a bit much. For the typical person, buying a lottery ticket is a bit of a lark, a couple dollars of disposable income spent because, what the heck, it’s about what you’d spend on one and a third sodas and you aren’t that thirsty. Lottery pools with coworkers or friends make it a small but fun social activity, too. That something is a net loss of money does not mean it is necessarily foolish. (This isn’t to say it’s wise, either, but I’d generally like a little more sympathy for people’s minor bits of recreational foolishness.)

Marc Anderson’s Andertoons (July 27) does a spot of wordplay about the meaning of “aftermath”. I can’t think of much to say about this, so let me just mention that Florian Cajori’s A History of Mathematical Notations reports (section 201) that the + symbol for addition appears to trace from writing “et”, meaning and, a good deal and the letters merging together and simplifying from that. This seems plausible enough on its face, but it does cause me to reflect that the & symbol also is credited as a symbol born from writing “et” a lot. (Here, picture writing Et and letting the middle and lower horizontal strokes of the E merge with the cross bar and the lowest point of the t.)

Berkeley Breathed’s Bloom County (July 27, rerun from, I believe, July of 1988) is one of the earliest appearances I can remember of the Grand Unification appearing in popular culture, certainly in comic strips. Unifications have a long and grand history in mathematics and physics in explaining things which look very different by the same principles, with the first to really draw attention probably being Descartes showing that algebra and geometry could be understood as a single thing, and problems difficult in one field could be easy in the other. In physics, the most thrilling unification was probably the explaining of electricity, magnetism, and light as the same thing in the 19th century; being able to explain many varied phenomena with some simple principles is just so compelling. General relativity shows that we can interpret accelerations and gravitation as the same thing; and in the late 20th century, physicists found that it’s possible to use a single framework to explain both electromagnetism and the forces that hold subatomic particles together and that break them apart.

It’s not yet known how to explain gravity and quantum mechanics in the same, coherent, frame. It’s generally assumed they can be reconciled, although I suppose there’s no logical reason they have to be. Finding a unification — or a proof they can’t be unified — would certainly be one of the great moments of mathematical physics.

The idea of the grand unification theory as an explanation for everything is … well, fair enough. A grand unification theory should be able to explain what particles in the universe exist, and what forces they use to interact, and from there it would seem like the rest of reality is details. Perhaps so, but it’s a long way to go from a simple starting point to explaining something as complicated as a penguin. I guess what I’m saying is I doubt Oliver would notice the non-existence of Opus in the first couple pages of his work.

Thom Bluemel’s Birdbrains (July 28) takes us back to the origin of numbers. It also makes me realize I don’t know what’s the first number that we know of people discovering. What I mean is, it seems likely that humans are just able to recognize a handful of numbers, like one and two and maybe up to six or so, based on how babies and animals can recognize something funny if the counts of small numbers of things don’t make sense. And larger numbers were certainly known to antiquity; probably the fact that numbers keep going on forever was known to antiquity. And some special numbers with interesting or difficult properties, like pi or the square root of two, were known so long ago we can’t say who discovered them. But then there are numbers like the Euler-Mascheroni constant, which are known and recognized as important things, and we can say reasonably well who discovered them. So what is the first number with a known discoverer?

## My June 2013 Statistics

I don’t understand why, but an awful lot of the advice I see about blogging says that it’s important not just to keep track of how your blog is doing, but also to share it, so that … numbers will like you more? I don’t know. But I can give it a try, anyway.

For June 2013, according to WordPress, I had some 713 page views, out of 246 unique visitors. That’s the second-highest number of page views I’ve had in any month this year (January had 831 views), and the third-highest I’ve had for all time (there were 790 in March 2012). The number of unique visitors isn’t so impressive; since WordPress started giving me that information in December 2012, I’ve had more unique visitors … actually, in every month but May 2013. On the other hand, the pages-per-viewer count of 2.90 is the best I’ve had; the implication seems to be that I’m engaging my audience.

The most popular posts for the past month were Counting From 52 to 11,108, which I believe reflects it getting picked for a class assignment somehow; A Cedar Point Follow-Up, which hasn’t got much mathematics in it but has got pretty pictures of an amusement park, and Solving The Price Is Right’s “Any Number” Game, which has got some original mathematics but also a pretty picture.

My all-time most popular posts are from the series about Trapezoids — working out how to find their area, and how many kinds of trapezoids there are — with such catchy titles as How Many Trapezoids I Can Draw, or How Do You Make A Trapezoid Right?, or Setting Out To Trap A Zoid, which should be recognized as a Dave Barry reference.

My most frequent commenters, “recent”, whatever that means, are Chiaroscuro and BunnyHugger (virtually tied), with fluffy, elkelement, MJ Howard, and Geoffrey Brent rounding out the top six.

The most common source of page clicks the past month was from the United States (468), with Brazil (51) and Canada (23) taking silver and bronze. And WordPress recorded one click each from Portugal, Serbia, Hungary, Macedonia (the Former Yugoslav Republic), Indonesia, Argentina, Poland, Slovenia, and Viet Nam. I’ve been to just one of those countries.

## A Cedar Point Follow-Up

I’m sure multiple people have a faint memory of several months ago, when I asked a question about getting the best view of something obstructed by a construction fence. The point was to catch the view at the Cedar Point amusement park, where the Disaster Transport bobsled coaster (and its building) and the Space Spiral were being torn out to be replaced with the GateKeeper roller coaster. The point of interest was whether the small collection of buildings which made up the Transport Refreshments stand was being preserved through all the demolition, and as of September 2012, there wasn’t any way to say.

I was happily able to get to Cedar Point this week and can offer the photograph here to show that they did indeed preserve the area. It’s been repainted and retitled, but probably we should have realized the logic: if there was enough need for someplace to sell Cheese on a Stick when the immediately adjacent rides were among the older and less flashy attractions, they’d surely want Cheese on a Stick when a new marquee ride was right across the entrance. (Well, they might have torn down all the buildings and put up new ones, but, they didn’t.)

I admit there’s not really fresh mathematics content here, but maybe someone was curious about the follow-up. There should be a couple of other pictures past the page cut, here.

## On Peeking At Cedar Point

I hadn’t intended to leave unanswered my little question about getting the best view of an obstructed attraction at Cedar Point, and apologize for that. Matters got in my way. And I really want to commend people to Geoffrey Brent’s solution, which avoids calculus in favor of geometric reasoning and so has that nice satisfying nature to it. (The part that turns into gibberish is rot13’d, so as not to spoil people: copy it to the box on Rot13.com and hit ‘Cypher’ to read it if you aren’t able to do the rot13 stuff in your head somehow.)

I do want to work out the solution by calculus methods, though, partly because that was actually easier for me, and partly to see whether my audience will put up with such. I’m trying to figure out how to present a more complicated subject which sure looks like it needs calculus to explain, and I’d like to have some sense whether I can write coherently on that topic so.

To set the stage: the problem was about where to stand, behind a tall obscuring fence, so as to see the greatest view of a building hidden behind the fence. To make for simple enough numbers, the viewer is assumed to have eyes six feet off the ground, the fence is eight feet tall, and the building, four feet beyond the fence, is twelve feet tall. Trusting that the ground is level — the reality isn’t quite, as it is at an amusement park — and that you can get as near or as far from the fence as you like, when does the angle between the top of the building and the top of the fence get its biggest?

## Peeking At Cedar Point

Back a couple months I wrote way too much about the problem of how many rides to expect on Cedar Point’s Disaster Transport, if we chose whether to re-ride it based on a random event. It struck me there’s another problem created by the amusement park’s removal of the indoor bobsled roller coaster. This one is based on Transport Refreshments, the block of food and drink stands which stood by the removed Disaster Transport and Space Spiral.

Specifically: what’s to become of that area? When my Dearly Beloved and I visited in late September the area was walled off, for construction, but one could rationalize any kind of fate for it. The block might get torn down to provide space for new rides; it might be left as-is, with the name Transport Refreshments left as a mysterious reference that new visitors would have to learn something of park history to understand; or the stands might be re-themed to the GateKeeper roller coaster being built. By now, probably, park-watchers really know, but when we visited, there wasn’t any telling, except by peeking over the fence.

The problem is you can’t see very much, because the fence is in the way. I’m tall and can hold my camera pretty high and so could get glimpses showing that the buildings hadn’t as of late September been torn down, and that they even had the sign in place, but that doesn’t mean much.

It does suggest a cute problem, though, one that’s easy to solve using calculus and maybe is solvable by easier tools. That problem’s, how do you get the best view of the hidden Transport Refreshments? Going up close to the fence means the fence obscures more of your field of view; getting farther away — the ground is roughly level here — reduces the field of view obscured by the fence, but also reduces the Transport Refreshments’ angular diameter. There’s probably a best spot to see what’s beyond, but, where is it?

To turn this into a word problem, let’s pretend things are nice round numbers: that the person doing the viewing has eyes about six feet off the ground, that the fence is eight feet tall, and that — four feet past the fence — the main sign for the Transport Refreshments stands twelve feet tall. I am sure these arbitrarily plucked numbers will produce only good results.

## It Would Have Been One More Ride Because

I apologize for being slow writing the conclusion of the explanation for why my Dearly Beloved and I would expect one more ride following our plan to keep re-riding Disaster Transport as long as a fairly flipped coin came up tails. It’s been a busy week, and actually, I’d got stuck trying to think of a way to explain the sum I needed to take using only formulas that a normal person might find, or believe. I think I have it.

## The Help Needed To Get to One

So, it’s established that my little series, representing the number of rides we could expect to get if we based re-riding on a fair coin flip, is convergent. So trying to figure out the sum will get a meaningful answer. The question is, how do we calculate it?

My first impulse is to see if someone else solved the problem first, for exactly the reasons you might guess. This is a case where mathematics textbooks can have an advantage over the web, really, since an introduction to calculus book is almost certain to have page after page of Common Series Sums. Figuring out the right combination of keywords to search the web for it can be an act of elaborate guesswork. Mercifully, Wikipedia has a List of Mathematical Series which covers my problem exactly. Almost.

## Why Not Infinitely Many More Rides?

Returning to the Disaster Transport ride problem: by flipping a coin after each ride of the roller coaster we’d decide whether to go around again. How many more times could I expect to ride? Using the letter k to represent the number of rides, and p(k) to represent the probability of getting that many rides, it’s a straightforward use of the formula for expectation value — the sum of all the possible outcomes times the probability of that particular outcome — to find the expected number of rides.

Where this gets to be a bit of a bother is that there are, properly speaking, infinitely many possible outcomes. There’s no reason, in theory, that a coin couldn’t come up tails every single time, and only the impatience of the Cedar Point management which would keep us from riding a million times, a billion times, an infinite number of times. Common sense tells us this can’t happen; the chance of getting a billion tails in a row is just impossibly tiny, but, how do we know all these outcomes that are incredibly unlikely don’t add up to something moderately likely? It happens in integral calculus all the time that a huge enough pile of tiny things adds up to a moderate thing, so why not here?

## Just One More Ride?

Given that we know the chance of getting any arbitrary number — let’s say k, because that’s a good arbitrary number — of rides in a row on Disaster Transport, using the scheme where we re-ride if the flipped coin comes up tails and stop if it comes up heads, the natural follow-up to me is: how many more rides can we expect? It’s more likely that we’d get one more ride than two, two more rides than three, three more rides than four; there’s a tiny chance we might get ten more rides; there’s a real if vanishingly tiny chance we’d get a million more rides, if Cedar Point didn’t throw us out of the park and tear the roller coaster down first.

## How Many Last Rides?

So our scheme for getting a last ride in on Disaster Transport without knowing in advance it was our last ride was to flip a coin after each ride, and then re-ride if the coin came up tails. (Maybe it was heads. It doesn’t matter, since we’re supposing the coin is equally likely to come up heads as tails.) The obvious question is, how many times could we expect to ride? Or put another way, how many times in a row could I expect a flipped coin to come up tails, before the first time that it came up heads? The probability tool used here is called the geometric distribution.

## The Last Ride Of A Roller Coaster

Cedar Point amusement park, in Sandusky, Ohio, built in the mid-1980s a bobsled-style roller coaster named Avalanche Run, because it was the mid-1980s and bobsled-style roller coasters seemed like a good idea. My home amusement park, Great Adventure, had something called the Sarajevo Bobsled opened in that time because back then Sarajevo was thought to be a pretty good city apart from that unpleasantness seventy years before. But Cedar Point’s bobsled roller coaster had a longer existence than Great Adventure’s, and around 1990, it was rebuilt to something newer and more exciting, with a building enclosing it and a whole backstory behind the ride.

## Reading the Comics, July 28, 2012

I intend to be back to regular mathematics-based posts soon. I had a fine idea for a couple posts based on Sunday’s closing of the Diaster Transport roller coaster ride at Cedar Point, actually, although I have to technically write them first. (My bride and I made a trip to the park to get a last ride in before its closing, and that lead to inspiration.) But reviews of math-touching comic strips are always good for my readership, if I’m readin the statistics page here right, so let’s see what’s come up since the last recap, going up to the 14th of July.