Skip
# Number Simulation

The digits on the left are only debug output. The simulated numbers are the curvy lines.

posted by DU at 5:57 AM on September 14, 2012

One of the mathematical definitions of "3" using pure set theory is as the equivalence class of {∅, {∅}, {{∅}} }

That is, we build a 3-element set out of nothing but the empty set and the notion of "containment", (without referencing "3", which would be circular), and then say: "3" is the equivalence class of ALL sets that can be put into 1-1 correspondence with the above. That is what "3" fundamentally is. The symbol (numeral) is just something we use to represent it. And, a set of 3 curved lines is a member of this equivalence class, as is a set of 3 apples, 3 people, 3 quarks, etc. Those are actual instances of 3, not just "simulations" of it.

I realize I'm risking sounding pedantic, but this is intended in fun, I hope it's taken that way.

posted by crazy_yeti at 6:19 AM on September 14, 2012 [1 favorite]

Each bar takes completes a full circle in the same number of steps as its position represents. For example, the bar representing "2" is a full half-circle, and it returns to its starting position every second step.

posted by owtytrof at 7:06 AM on September 14, 2012 [1 favorite]

I think that's Firefox. I have that problem with more and more websites. God help me if there is a suppressed popup. Locks everything up.

This is a creative prime number simulator, but I wouldn't call it useful.

posted by gjc at 7:23 AM on September 14, 2012

I dunno about you guys, but I am getting tired of all these visual simulations of naïve modulus-based prime generators. Are we sure this is not a double?

posted by ricochet biscuit at 7:34 AM on September 14, 2012 [2 favorites]

But each bar represents a particular number, the same way an individual numeral might, so it's the same level of abstraction as a number but with a different representation scheme. Anyway, I don't think this is "number simulation" (I don't know what it means to simulate a number), but algorithm visualization. On that note, I don't think this is visualizing the sieve of Erathosthenes, because it marks primes as it goes without considering their multiples, and it seems like this method could conceivably continue indefinitely.

posted by invitapriore at 7:43 AM on September 14, 2012

That's not how the quantity 3 is being represented in the simulation. The quantity 3 is being represented by a single line rotating around the center 3 times per unit time. And while space and time are merely dimensions, it's less obvious that groups in time clearly represent numbers than groups in space.

But maybe a better way to say it is that you have changed to a representation (rotation rates) where the property you are interested in is best noticed by simulation, not calculation.

posted by DU at 7:59 AM on September 14, 2012

He's an optimist.

posted by metaBugs at 8:00 AM on September 14, 2012 [3 favorites]

Yeah, but that's just doing Eratosthenes with a bit of lazy evaluation — instead of marking the multiples ahead of time, it marks each only when it needs to know whether it's been marked. Or, more precisely, it's scheduled evaluation — since it knows ahead of time when it will need to know that something has been marked, it sets up a marking clock that will go off at the right moment. I think most people who implement the sieve of Eratosthenes think of such things (I know I did), because these are not substantial changes of algorithm but minor and fairly obvious variations.

That's why I consider it essentially the same as the standard sieve of Eratosthenes. (But of course I respect that not everybody has quite the same notion of "essentially the same" that I do, and experience shows that my notion is often a bit coarser than others accept.)

What attracts my admiration here is not the design of the prime-finding algorithm, which is mundane, but the design of the visualization, which I find clever and only obvious in hindsight.

posted by stebulus at 8:29 AM on September 14, 2012

I take that back; my first attempt, calling it lazy evaluation, was better. Standard Eratosthenes marks a finite list of multiples, then moves on to the next prime. This kind of Eratosthenes marks an infinite list of multiples, implemented as a lazy list which is consumed as needed. It's pretty straight-up lazy evaluation.

posted by stebulus at 8:37 AM on September 14, 2012

posted by crazy_yeti at 8:38 AM on September 14, 2012

This is actually a real phenomenon. Numbers that are one more or one less than numbers with lots of factors are more likely to be prime than typical numbers of the same size. (IANAANT, so I'm just going to state this without citation.)

posted by madcaptenor at 12:54 PM on September 14, 2012 [2 favorites]

Post

# Number Simulation

September 14, 2012 2:31 AM Subscribe

Number simulation, because it is Friday.

Another way to see numbers.

Another way to see numbers.

Doesn't work in Firefox/Linux. Love the new web. Reminds me of the old web.

posted by deo rei at 2:48 AM on September 14, 2012 [5 favorites]

posted by deo rei at 2:48 AM on September 14, 2012 [5 favorites]

I had a real hard time getting it started in Firefox. I was only able to get it to work by opening it in a new tab, and staying on this page for about 20 seconds, and only then flipping over to the new tab. Then it started running. Otherwise, it just sits there.

Once it's actually running, right and left arrow change speed, but that doesn't seem to work unless it runs.

Didn't work in IE at all.

posted by Malor at 2:52 AM on September 14, 2012

Once it's actually running, right and left arrow change speed, but that doesn't seem to work unless it runs.

Didn't work in IE at all.

posted by Malor at 2:52 AM on September 14, 2012

FWIW it worked for me in Firefox (15.0.1). Not right away, but eventually. Since I didn't know what to expect, I didn't know if it was working or not. Still don't, really. Though the image is moving, the keys do what they say they do, and I feel sort of like I'm back in the 8th grade, watching someone play Tempest.

posted by chavenet at 3:04 AM on September 14, 2012

posted by chavenet at 3:04 AM on September 14, 2012

It's showing prime numbers. If there are no arcs between the center (1) and the current number, it means there are no other divisors, and it gets added to the left. A visual simulation of a naïve modulus-based prime generator, really.

posted by sonic meat machine at 3:09 AM on September 14, 2012 [7 favorites]

posted by sonic meat machine at 3:09 AM on September 14, 2012 [7 favorites]

It's working here in Firefox/Linux (Ubuntu). I think there's a wee timing problem loading the script and the page. F5 to reload and it started working.

posted by Wrinkled Stumpskin at 3:12 AM on September 14, 2012

posted by Wrinkled Stumpskin at 3:12 AM on September 14, 2012

The curvature allows the correct cycling of divisors to match up with numbers which are their multiple. Basically, each ring has an appropriate rotation speed, meaning that, for example, 12 lines up with 2, 3, 4, and 6.

posted by sonic meat machine at 3:38 AM on September 14, 2012 [4 favorites]

posted by sonic meat machine at 3:38 AM on September 14, 2012 [4 favorites]

Will this help me solve the Front Seat/Back Seat conundrum?

posted by Mezentian at 3:38 AM on September 14, 2012 [6 favorites]

posted by Mezentian at 3:38 AM on September 14, 2012 [6 favorites]

Wow, that's lovely. Took me ages to figure out what was going on, but it's an elegant idea and one I've never seen before.

What's the rule governing the relative speeds of the bars? It looks like they spiral inwards to form concentric rings, which all travel at the same speed (pixels/sec, rather than degrees/sec)... is that right? Can anyone pretend that I'm an imbecile and explain why it works?

It's quite flaky in FF/Win7: Froze after a few seconds, worked well for a while after I reloaded the page, and then stopped again when I switched tabs to write this. Very pretty when it's going, though.

posted by metaBugs at 3:39 AM on September 14, 2012

What's the rule governing the relative speeds of the bars? It looks like they spiral inwards to form concentric rings, which all travel at the same speed (pixels/sec, rather than degrees/sec)... is that right? Can anyone pretend that I'm an imbecile and explain why it works?

It's quite flaky in FF/Win7: Froze after a few seconds, worked well for a while after I reloaded the page, and then stopped again when I switched tabs to write this. Very pretty when it's going, though.

posted by metaBugs at 3:39 AM on September 14, 2012

Super cool.

The bar representing 2 makes a revolution every two steps. The bar representing 3 makes a revolution every 3 steps. Etc. That's why when a prime shows up, the middle dot is able to shine a red light on it: the other bars are all in the midst of a revolution and aren't in the way to block the light.

posted by painquale at 3:42 AM on September 14, 2012 [2 favorites]

The bar representing 2 makes a revolution every two steps. The bar representing 3 makes a revolution every 3 steps. Etc. That's why when a prime shows up, the middle dot is able to shine a red light on it: the other bars are all in the midst of a revolution and aren't in the way to block the light.

posted by painquale at 3:42 AM on September 14, 2012 [2 favorites]

Really neat. It's fun to hold down the right arrow key and make it spin faster and faster. Take that, maths! Wheeee!

posted by fight or flight at 3:49 AM on September 14, 2012

posted by fight or flight at 3:49 AM on September 14, 2012

I think someone heard of the Ulam spiral and tried to make an interactive version. I don't think it works quite as well but it was an interesting attempt.

posted by DU at 4:12 AM on September 14, 2012 [1 favorite]

posted by DU at 4:12 AM on September 14, 2012 [1 favorite]

The number simulator worked for me after hitting refresh 3 or 4 times.

The display reminded me of the Whitney Chromatic music player (warning-plays sounds), but that player works from the outside in:

"In three minutes, the largest dot will travel around the circle once, the next largest dot will travel around the circle twice, the next largest dot three times, and so on.

The dots are arranged to trigger notes on a chromatic scale when they pass the line."

Some other variations from it's sidebar:

One minute loop

Bells

posted by jjj606 at 4:39 AM on September 14, 2012 [5 favorites]

The display reminded me of the Whitney Chromatic music player (warning-plays sounds), but that player works from the outside in:

"In three minutes, the largest dot will travel around the circle once, the next largest dot will travel around the circle twice, the next largest dot three times, and so on.

The dots are arranged to trigger notes on a chromatic scale when they pass the line."

Some other variations from it's sidebar:

One minute loop

Bells

posted by jjj606 at 4:39 AM on September 14, 2012 [5 favorites]

It's cool. But buggy as hell. After umpteen reloads and nothing happening, the thing finally started moving. Then it stopped and I had to reload it again. It was running and I could use the left/right arrows to marginally adjust speed, but never could get any obvious zoom to work. Then, I made the mistake of moving my mouse. Not clikcing, mind you, juts moving the cursor a bit. That froze the simulation and another reload was in order.

posted by Thorzdad at 4:39 AM on September 14, 2012

posted by Thorzdad at 4:39 AM on September 14, 2012

Also, behind the scenes, they have to use a sieve to make sure that floating point rounding errors don't misidentify a prime.

posted by Obscure Reference at 4:49 AM on September 14, 2012 [1 favorite]

posted by Obscure Reference at 4:49 AM on September 14, 2012 [1 favorite]

Actually, I'm going to take that back. This is at least as interesting as the Ulam spiral. If you watch it longer, there seem to be patterns. Like you'll see a whole stack of factors go by and the next number is prime. All the "orbital debris" is lined up, which makes a clear "lane" "out to" the next number, which is then "made prime".

posted by DU at 4:58 AM on September 14, 2012 [5 favorites]

posted by DU at 4:58 AM on September 14, 2012 [5 favorites]

In firefox for me, it seems to simply be having an adverse reaction to mouseovers -- so keep your cursor over the reload button (or outside of the window) and it works.

posted by advil at 5:18 AM on September 14, 2012

posted by advil at 5:18 AM on September 14, 2012

Works great in Chrome.

posted by the man of twists and turns at 5:20 AM on September 14, 2012 [2 favorites]

posted by the man of twists and turns at 5:20 AM on September 14, 2012 [2 favorites]

Doesn't work at all for me on Firefox 14.0.1 (Linux), even following advil's advice above. Too bad, it seems like a nice idea.

Another nitpick - I don't think this is

posted by crazy_yeti at 5:31 AM on September 14, 2012

Another nitpick - I don't think this is

*simulating*numbers. The numbers are*real*(well, integer anyhow!)posted by crazy_yeti at 5:31 AM on September 14, 2012

In Firefox 15.0.1 on Unbuntu it only works if I don't move the mouse over the animation. If I keep the mouse still or have the mouse pointer off the tab then it works. Once it has frozen it needs reloading.

posted by antiwiggle at 5:50 AM on September 14, 2012

posted by antiwiggle at 5:50 AM on September 14, 2012

I keep getting error messages too (Chrome and Firefox on Windows). It might be the proxy settings or something here at work (sometimes even our own website won't render properly) so maybe I can see it when I get home. Sounds interesting.

posted by TedW at 5:53 AM on September 14, 2012

posted by TedW at 5:53 AM on September 14, 2012

*I don't think this is simulating numbers. The numbers are real (well, integer anyhow!)*

The digits on the left are only debug output. The simulated numbers are the curvy lines.

posted by DU at 5:57 AM on September 14, 2012

**DU,**I get that. But when there are 3 curvy lines, that's an actual instance of "three", not a simulation. I might say it's actually a truer representation of "three" than the numeric symbol "3"!

One of the mathematical definitions of "3" using pure set theory is as the equivalence class of {∅, {∅}, {{∅}} }

That is, we build a 3-element set out of nothing but the empty set and the notion of "containment", (without referencing "3", which would be circular), and then say: "3" is the equivalence class of ALL sets that can be put into 1-1 correspondence with the above. That is what "3" fundamentally is. The symbol (numeral) is just something we use to represent it. And, a set of 3 curved lines is a member of this equivalence class, as is a set of 3 apples, 3 people, 3 quarks, etc. Those are actual instances of 3, not just "simulations" of it.

I realize I'm risking sounding pedantic, but this is intended in fun, I hope it's taken that way.

posted by crazy_yeti at 6:19 AM on September 14, 2012 [1 favorite]

So really, the numeral "3" is what is the "simulation".

posted by Galaxor Nebulon at 6:53 AM on September 14, 2012

posted by Galaxor Nebulon at 6:53 AM on September 14, 2012

But do these numbers have any concept of good and evil?

posted by mazola at 6:55 AM on September 14, 2012 [1 favorite]

posted by mazola at 6:55 AM on September 14, 2012 [1 favorite]

*What's the rule governing the relative speeds of the bars?*

Each bar takes completes a full circle in the same number of steps as its position represents. For example, the bar representing "2" is a full half-circle, and it returns to its starting position every second step.

posted by owtytrof at 7:06 AM on September 14, 2012 [1 favorite]

It's a visualization of the sieve of Eratosthenes.

posted by stebulus at 7:07 AM on September 14, 2012 [2 favorites]

posted by stebulus at 7:07 AM on September 14, 2012 [2 favorites]

*It's cool. But buggy as hell. After umpteen reloads and nothing happening, the thing finally started moving. Then it stopped and I had to reload it again. It was running and I could use the left/right arrows to marginally adjust speed, but never could get any obvious zoom to work. Then, I made the mistake of moving my mouse. Not clikcing, mind you, juts moving the cursor a bit. That froze the simulation and another reload was in order.*

I think that's Firefox. I have that problem with more and more websites. God help me if there is a suppressed popup. Locks everything up.

This is a creative prime number simulator, but I wouldn't call it useful.

posted by gjc at 7:23 AM on September 14, 2012

*A visual simulation of a naïve modulus-based prime generator, really.*

I dunno about you guys, but I am getting tired of all these visual simulations of naïve modulus-based prime generators. Are we sure this is not a double?

posted by ricochet biscuit at 7:34 AM on September 14, 2012 [2 favorites]

*But when there are 3 curvy lines, that's an actual instance of "three", not a simulation.*

But each bar represents a particular number, the same way an individual numeral might, so it's the same level of abstraction as a number but with a different representation scheme. Anyway, I don't think this is "number simulation" (I don't know what it means to simulate a number), but algorithm visualization. On that note, I don't think this is visualizing the sieve of Erathosthenes, because it marks primes as it goes without considering their multiples, and it seems like this method could conceivably continue indefinitely.

posted by invitapriore at 7:43 AM on September 14, 2012

*But when there are 3 curvy lines, that's an actual instance of "three", not a simulation.*

That's not how the quantity 3 is being represented in the simulation. The quantity 3 is being represented by a single line rotating around the center 3 times per unit time. And while space and time are merely dimensions, it's less obvious that groups in time clearly represent numbers than groups in space.

But maybe a better way to say it is that you have changed to a representation (rotation rates) where the property you are interested in is best noticed by simulation, not calculation.

posted by DU at 7:59 AM on September 14, 2012

That's Numberwang!

posted by Jaymzifer at 7:59 AM on September 14, 2012 [5 favorites]

posted by Jaymzifer at 7:59 AM on September 14, 2012 [5 favorites]

*full half-circle*

LOL wut?

LOL wut?

He's an optimist.

posted by metaBugs at 8:00 AM on September 14, 2012 [3 favorites]

So are pi and prime numbers linked in some way I haven't heard about?

posted by Neale at 8:10 AM on September 14, 2012

posted by Neale at 8:10 AM on September 14, 2012

Hypnotically beautiful. Once it finally got going, I could watch that for minutes. (Hours is probably pushing it, but definitely into the tens of minutes)

posted by talitha_kumi at 8:24 AM on September 14, 2012

posted by talitha_kumi at 8:24 AM on September 14, 2012

*On that note, I don't think this is visualizing the sieve of Erathosthenes, because it marks primes as it goes without considering their multiples, and it seems like this method could conceivably continue indefinitely.*

Yeah, but that's just doing Eratosthenes with a bit of lazy evaluation — instead of marking the multiples ahead of time, it marks each only when it needs to know whether it's been marked. Or, more precisely, it's scheduled evaluation — since it knows ahead of time when it will need to know that something has been marked, it sets up a marking clock that will go off at the right moment. I think most people who implement the sieve of Eratosthenes think of such things (I know I did), because these are not substantial changes of algorithm but minor and fairly obvious variations.

That's why I consider it essentially the same as the standard sieve of Eratosthenes. (But of course I respect that not everybody has quite the same notion of "essentially the same" that I do, and experience shows that my notion is often a bit coarser than others accept.)

What attracts my admiration here is not the design of the prime-finding algorithm, which is mundane, but the design of the visualization, which I find clever and only obvious in hindsight.

posted by stebulus at 8:29 AM on September 14, 2012

*Or, more precisely, it's scheduled evaluation*

I take that back; my first attempt, calling it lazy evaluation, was better. Standard Eratosthenes marks a finite list of multiples, then moves on to the next prime. This kind of Eratosthenes marks an infinite list of multiples, implemented as a lazy list which is consumed as needed. It's pretty straight-up lazy evaluation.

posted by stebulus at 8:37 AM on September 14, 2012

*The quantity 3 is being represented by a single line rotating around the center 3 times per unit time.*A-ha! Maybe if this thing actually ran in my browser, I would have understood that, and not posted my comment above :-)

posted by crazy_yeti at 8:38 AM on September 14, 2012

This is beautiful. I feel like I have intuition now for twin primes. Each pair of twins is separated by a big stack of the "orbital debris" that DU observes (a composite with many factors) clearing out lanes on both sides.

posted by drdanger at 9:00 AM on September 14, 2012 [1 favorite]

posted by drdanger at 9:00 AM on September 14, 2012 [1 favorite]

I'll just leave this here: Lazy Wheel Sieves and Spirals of Primes.

posted by thedward at 9:01 AM on September 14, 2012 [4 favorites]

posted by thedward at 9:01 AM on September 14, 2012 [4 favorites]

Nice find, thedward.

(Direct link, without google cruft.)

posted by stebulus at 9:16 AM on September 14, 2012

(Direct link, without google cruft.)

posted by stebulus at 9:16 AM on September 14, 2012

I'm going to throw on

posted by WinnipegDragon at 9:26 AM on September 14, 2012

*Lateralus*, put this on the big screen, black out the windows, crank the speed to max and BLOW MY MIND.posted by WinnipegDragon at 9:26 AM on September 14, 2012

Worked fine for me straight off the bat in Firefox. I'm assuming it's the awesome power of my Vista OS.

posted by yoink at 10:17 AM on September 14, 2012 [1 favorite]

posted by yoink at 10:17 AM on September 14, 2012 [1 favorite]

*Actually, I'm going to take that back. This is at least as interesting as the Ulam spiral. If you watch it longer, there seem to be patterns. Like you'll see a whole stack of factors go by and the next number is prime. All the "orbital debris" is lined up, which makes a clear "lane" "out to" the next number, which is then "made prime".*

This is actually a real phenomenon. Numbers that are one more or one less than numbers with lots of factors are more likely to be prime than typical numbers of the same size. (IANAANT, so I'm just going to state this without citation.)

posted by madcaptenor at 12:54 PM on September 14, 2012 [2 favorites]

This is way cool, thanks for posting it.

posted by LobsterMitten at 9:04 PM on September 14, 2012

posted by LobsterMitten at 9:04 PM on September 14, 2012

« Older The Rockwell International Integrated Space Plan | Long live logolepsy Newer »

This thread has been archived and is closed to new comments

posted by chavenet at 2:42 AM on September 14, 2012 [3 favorites]