CodingTrain / CodingTrain/Suggestion-Box

Pi Day 2023 - Visualization of Pi via the Chaos Game

Aperta
#1,782 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
570
Fork
85
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hello,
I know it is kind of early for $\pi$ day, but here is my suggestion for a short challenge on it: visualize $\pi$ via the Chaos Game. It is another way to show (visually) that its digits are actually random. I have made a version of it [with p5js](https://editor.p5js.org/silvas/full/zllj1loyg) using only 50k digits.
![pi_visualized](https://user-images.githubusercontent.com/18087952/214307705-ad5e348d-c1c1-4629-9514-ba95b6a75f96.png)

The great Shiffman made videos on the Chaos Game in the past (Coding Challenge 123 [part 1](https://youtu.be/7gNzMtYo9n4) and [part2](https://youtu.be/A0NHGTggoOQ)), so it shouldn't be new to the fans, but I will provide a short explanation of what you see above.

You start with 10 equally spaced points on a circle that represent the digits {0,1,2,3,4,5,6,7,8,9}. Pick also another point in the plane (in the picture above, if you look closely you can see I started at the center of the circle). In the Chaos Game you will then ***randomly*** choose one of those points on the circle, move a certain distance towards it, and repeat indefinitely. However, this time, we will choose the point on the circle following the digits of $\pi$: we will first move towards the point representing $1$, then towards $4$, then $1$, then $5$, then $9$, and so on. You may ask how much should we move towards each point? whatever we want! I used $(\sqrt{5}-2)$, so at every step we move approximately $0.236$ of the distance between the current and the target point. I calculated this number using a formula that guarantees just-touching shapes [^1]. The fact that we obtain the same final picture following either method, shows that there is no discernible pattern in the digits of $\pi$, i.e. they are random.

## Further variations

What if we read the digits of $\pi$ two at a time? That is we have a two-digit number $14$, $15$, $92$, etc. instead of $1$, $4$, $1$, $5$, $9$, $2$, etc. Should we use 100 equally spaced points on the circle? Sure, but since 100 is divisible by 4 and 5, we can group the two-digits into 4 or 5 groups or take them modulo 4 or 5. Therefore we could use only 4 or 5 equally spaced points on the circle.

*What shape should we expect to obtain?*

[^1]: Refer to [Larry Riddle at Agnes Scott College](https://www.larryriddle.agnesscott.org/ifs/pentagon/ngondet.htm) or the article by **Schlicker and Dennis**, "*Sierpinski n-gons*", Pi Mu Epsilon Journal, **10** (1995), No. 2, 81-89.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia con lo sketch p5.js collegato e la spiegazione di Chaos Game nell’issue, comprese le variazioni proposte che usano le cifre di pi. Chiarisci se il repository dovrebbe trasformare questa idea in una challenge o in una visualizzazione; per considerare il lavoro completato, sarebbero necessari un ambito di implementazione concordato e una spiegazione corrispondente del risultato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.