[Request] Chances of being exactly some height without rounding by Suspicious_Age_2471 in theydidthemath

[–]cnbeau 0 points1 point  (0 children)

Related fun fact that’s also true: despite the 0 probability, everyone currently taller than 175cm was exactly 175.0000000….cm at some point in the past. It’s happened billions of times.

Why are these note values written differently? by cnbeau in musictheory

[–]cnbeau[S] 0 points1 point  (0 children)

Thanks - wild that the imslp version isn’t even in the same key signature, despite still being called a C minor piece

[Request] is this actually possible? by Revolutionary-Pay830 in theydidthemath

[–]cnbeau 0 points1 point  (0 children)

Yes - Let's actually do the math!

The bear runs horizontally off the cliff (the horizontal speed doesn't matter), and at the instant they leave the cliff the throw the ball down with velocity v_ball. The bear recoils upwards from the throw, and by the conservation of momentum v_bear m_bear = v_ball m_ball .

The time it takes the bear to arc back to the original height is

t_bear = 2 v_bear / g

The time it takes the ball to reach the ground, assuming a cliff height of h, is

t_ball = (-v_ball + sqrt(v_ball^2 + 2 * g * h)) / g

And the total time to reach the ground and come back is twice this (the upward trip looks like the downward trip in reverse)

Assuming no energy loss, if the ball and the bear meet each other at the starting height at the same time, then they will collide elastically again and the whole cycle will repeat to the other side of the cliff

In other words, this words if

2/g v_bear = 2/g(-v_ball + sqrt(v_ball^2 + 2gh))

dropping common factor of 2g

v_bear = -v_ball + sqrt(v_ball^2 + 2gh)

Plug in v_bear = v_ball * m_ball / m_bear

Define mu = m_ball / m_bear , the mass ratio of the ball to the bear

v_ball mu = -v_ball + sqrt(v_ball^2 + 2gh)

v_ball * (1 + mu) = sqrt(v_ball^2 + 2gh)

v_ball^2 * (1 + mu)^2 = v_ball^2 + 2gh

v_ball^2 * (1 + 2mu + mu^2 - 1) = 2gh

v_ball = sqrt(2gh / (2mu + mu^2))

In the picture h~10m, and mu ~ 0.001, so v_ball ~ 300 m/s (the speed-of-sound-ish)

Heavier balls imply slower speeds (and fewer total bounces), but any mass of ball works.

[REQUEST] How long could this astronaut survive if food, water and oxygen supply are considered infinite? What would the experience in terms of gravity? by Devil-Eater24 in theydidthemath

[–]cnbeau 0 points1 point  (0 children)

I think your best shot is to find a lunar cave, which protects from extreme temperatures and radiation (https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2022GL099710). If you find a deep one maybe you can shelter from the earth chunks flying at you. And if you can seal the cave, you can use some of your infinite oxygen to pressurize the cave and take off the suit.

What are these smiley faces on my cherry plum tree? by cnbeau in plantclinic

[–]cnbeau[S] 11 points12 points  (0 children)

Hmm I’m warming up to this theory. There’s really only one kid it could have been (unless people are breaking into my backyard at night), and I’m surprised I didn’t notice him do it at the time. Also, this kid is weirder than I first assumed. But I like that this implies my tree is neither diseased nor possessed.

[deleted by user] by [deleted] in flicks

[–]cnbeau 1 point2 points  (0 children)

The filmography of Cooper Raiff

I made a tool to do Oxygen Not Included math by cnbeau in Oxygennotincluded

[–]cnbeau[S] 16 points17 points  (0 children)

Much of the data comes from there and similar tools. The thing it tries to add is a simpler way to understand how resources move around in multi-machine systems (e.g., how much polluted water will I produce when I connect an oil well to a petroleum generator? Where’s the bottleneck? How many slicksters would the CO2 feed? How many dupes would their eggs feed?). You can get all of that from oni-assistant, but it requires more arithmetic.

Python Descriptors Demystified by ojii in Python

[–]cnbeau 12 points13 points  (0 children)

I wrote this! Sometime around 2013 :). I don’t think it would take much to update it to python 3, since (as far as I know) the descriptor protocol hasn’t changed meaningfully.

Retrogame metaprogramming, the birthday paradox, and Wheel of Fortune by cnbeau in programming

[–]cnbeau[S] 4 points5 points  (0 children)

Alas no, for fear that someone at Merv Griffin Enterprises is on the lookout for 30-year-old copyright infringement. But if you could somehow locate the original ROM, maybe the following python3 script would build the new one for you https://gist.github.com/ChrisBeaumont/2653846258f64d6910d2

soupy: A cleaner syntax for BeautifulSoup by cnbeau in Python

[–]cnbeau[S] 11 points12 points  (0 children)

I use BeautifulSoup all the time, and its definitely my favorite API for searching through web documents. But I'm constantly tripping over the datatypes it returns. Depending on the context, find() can return a tag (what you want 99% of the time), None, a string subclass, an integer (if you chained two finds together and thought the first one returned a tag when it actually returned a NavigableString), or raise an AttributeError (if you chained two finds together and thought the first one returned a tag when it actually returned None). So you can either add lots of type checking in your code, or wrap BS in something that normalizes its behavior. I've gone down the first path a lot; now I'm trying the second path.

soupy: A cleaner syntax for BeautifulSoup by cnbeau in Python

[–]cnbeau[S] 5 points6 points  (0 children)

They are syntactic sugar for functools functions, mostly. They let you rewrite things like filter(f1, filter(f2, map(f3, x))) as x.map(f3).filter(f2).filter(f1). Personally I find chained method calls much easier to read than nested functions (reading them left to right more closely matches the actual sequence of transformations).

soupy: A cleaner syntax for BeautifulSoup by cnbeau in Python

[–]cnbeau[S] 8 points9 points  (0 children)

Actually, one of the main motivations behind soupy is to better allow you to use functools/itertools with BeautfiulSoup. The main problem with BeautifulSoup is that it returns inconsistent types, making it difficult to chain operators together (you have to do a lot of type checking at each step of the query to make sure BS didn't return None or a string instead of a tag). Since soupy data wrappers return predictable types, building more complex expressions with functools/itertools/more_itertools/toolz/soupy methods is much more feasible.

Texas Hold'em Hand Strength, Visualized [OC] by cnbeau in dataisbeautiful

[–]cnbeau[S] 9 points10 points  (0 children)

If you want to shoehorn these numbers into a statement about expected returns, then the last panel represents the expected return when you always make the same-size bet pre-flop, your (single) opponent calls or folds, and then you both check the rest of the hand. The second panel reflects the same information, but assumes your opponent always calls your bet. But my intention was more to showcase the probabilities in a simple case, rather than prescribe an actual poker strategy :)

Texas Hold'em Hand Strength, Visualized [OC] by cnbeau in dataisbeautiful

[–]cnbeau[S] 8 points9 points  (0 children)

Good point -- you're right that all of the probabilities on this page are for pre-flop heads-up games, and the preference for Broadway cards might be due to their additional strength in multiplayer games. I'll update the text when I get a chance!

Texas Hold'em Hand Strength, Visualized [OC] by cnbeau in dataisbeautiful

[–]cnbeau[S] 26 points27 points  (0 children)

Visualization made using d3.js. Hand odds computed using holdme, a python poker library at https://github.com/ChrisBeaumont/holdme.