here's a π spigot from this blog post.
a while ago, i implemented one of the algorithms here in scheme. it was fun to get a megabyte of π, and i want you to be able to have a similar experience :D.
this version is unproven, as discussed in the original article, buuuut idrc.
fair warning: especially with larger batch sizes, this is liable to freeze up the tab. tread carefully!
3.
1 digits in batches of
gotta say, it's really sweet working with native generators. not really necessary here, but elegant.
bigints were the real hero, i almost discarded the idea before i remembered js had them :P
at around 215 digits, the bigints become too big to allocate, at least on my machine. lame!
a while ago, i made this cohost post about approximating π,
and i'd like to implement my favorite approach here
in batches of
current best guess: 0/0 * 4 = idk
this is thoroughly ingrained in my brain, but i hope it's still fairly intuitive for others.
i like how the boundary becomes more clear with more samples, it makes the accuracy more understandable imo
the technique as applied in s6 may be pointless, but, for a general equality, points that can move in two directions could actually be interesting!
that might be here! in ! th efuture
= samples2
okay dang this looks freaking great. hue is based on angle, look at the code! i love this
i have decided that instead of making it more accurate, i will leave it at this place of looking very cool
i realized something when talking about s7: i may be stupid.
first of all, it's worth understanding that s7 is actually my third go at this technique,
the first time was on about:blank in canvas, and the second time was in picotron.
th derivative
i just have to graph the function! the other method just looks cooler and is less reliable
here's the important part of the code: ctx.fillRect(x.map(x0, x1, 0, 300), f(x).map(y0, y1, 300, 0), 1, 1)
now, this is hardly “production-grade,” but it is fun. first play, then talk.
now this is a very janky demo for many, many reasons, but there's a kernel of an idea here that's very cool: moving a bunch of things independently to do a big thing.
some ideas to make this suck less:
fix the horrendous onchange behavior to actually stop the previous attempt
i have my blog for when i want to make really legit-looking posts.
it's made with pollen, which is great, and i can make even the most lame posts (currently all of the posts) look very nice.
however, there's a whole build system, the book is a program after all, a lot of things have to happen to make a post there happen. so i wanted something smaller. micro, if you will.
hence, spout! i just write some html (which, tbh, i kinda prefer to markdown) with no restrictions. ssh, edit file, save file, done. it's great! it really needs an RSS feed, though…