diff --git a/content/posts/a-mathematical-curiosity.md b/content/posts/a-mathematical-curiosity.md index 3e72cac..2889927 100644 --- a/content/posts/a-mathematical-curiosity.md +++ b/content/posts/a-mathematical-curiosity.md @@ -7,11 +7,7 @@ tags: ["math"] --- -{{< rawhtml >}} - - - -{{< /rawhtml >}} +{{< katex >}} *Originally posted on my [old old private blog](https://artofproblemsolving.com/community/c922786h1895231_a_mathematical_curiosity)* diff --git a/content/posts/asian-bayesian.md b/content/posts/asian-bayesian.md index 1fd2bd8..dade9d1 100644 --- a/content/posts/asian-bayesian.md +++ b/content/posts/asian-bayesian.md @@ -7,13 +7,9 @@ tags: ["math", "game-theory", "probability", "fun", "numerical-computing", "bad- --- -{{< rawhtml >}} - - - - - -{{< /rawhtml >}} +{{< katex >}} +{{< sagecell >}} + Recently, I noticed that "Bayesian", as in Bayesian statistics or Bayesian inference, sounds very close to "Asian". Pun potential! @@ -56,8 +52,8 @@ Using the equation from above, $p(k) = \frac{1}{A}$, we get This integral can be computed because it's just a polynomial, but then you have to find the root of a high-degree polynomial, so there's probably no explicit formula for the cutoff $k$. However, we can solve it numerically using SageMath! -{{< rawhtml >}} -
-{{< /rawhtml >}} +{{< /sagescript >}} The first three answers seem reasonable, but the fourth one is totally wack! Only one third of the players applying when half of them can get in? What's going on? The culprit is loss-of-precision. The left side blows up to gigantic numbers, while the right side becomes a high-degree polynomial. If we move the factorials to inside the integral, we get much more reasonable results. -{{< rawhtml >}} -
-{{< /rawhtml >}} +{{< /sagescript >}} Much better! Try testing out some other values of $N, M, A$ to see what happens. Also, using math lingo, $p(x)$ is actually the cumulative distribution for the beta distribution, so we can also use SageMath's [built-in functions](https://doc.sagemath.org/html/en/reference/probability/sage/probability/probability_distribution.html#sage.probability.probability_distribution.RealDistribution.cum_distribution_function) to compute $k$ instead of writing out all the factorials and stuff. -{{< rawhtml >}} -
-{{< /rawhtml >}} +{{< /sagescript >}} As you can see, our own implementation still has some precision issues, and doesn't quite match the results from using SageMath's beta distribution, but it's better than our first attempt. Lesson learned: leave numerical computation to the experts and use the built-in functions whenever possible. diff --git a/content/posts/why-the-name-saya.md b/content/posts/why-the-name-saya.md index dd978be..5ccc72d 100644 --- a/content/posts/why-the-name-saya.md +++ b/content/posts/why-the-name-saya.md @@ -18,7 +18,7 @@ That thing is mind-boggling massive. When I visited Yellowstone a few years ago, But why was I at Yellowstone in the first place? Well, of course because of the supervolcano! Not to see the supervolcano itself (apparently scientists couldn't find the caldera for a long time because they didn't expect it to be so big), but because the supervolcano is the reason for all of Yellowstone's wonderful hot springs and geysers and landscapes. Also, if you commit a crime in the Idaho section of Yellowstone, there's [supposedly a loophole in the Constitution](https://en.wikipedia.org/wiki/Zone_of_Death_(Yellowstone) so that you can't get put on trial for it. In reality, you'd probably get a trial anyways. -My family drove to Yellowstone since our house is in St. Louis which isn't that far away, and also because there aren't any nice airports near Yellowstone. Along the way, we saw a lot of horses, antelope, and cows, but no Belted Galloways unfortunately, which we did see on a previous road trip. In particular, we passed by a group of particularly depressed-looking horses within 50 miles of Yellowstone, and my parents described the horses as {{< rawhtml >}}(yōu)(){{< /rawhtml >}} (ruby annotations in HTML are kinda gory), which is a term I didn't know at the time. +My family drove to Yellowstone since our house is in St. Louis which isn't that far away, and also because there aren't any nice airports near Yellowstone. Along the way, we saw a lot of horses, antelope, and cows, but no Belted Galloways unfortunately, which we did see on a previous road trip. In particular, we passed by a group of particularly depressed-looking horses within 50 miles of Yellowstone, and my parents described the horses as 忧郁 (yōuyù), which is a term I didn't know at the time. Later, I looked up [忧郁 on Wiktionary](https://en.wiktionary.org/wiki/%E6%86%82%E9%AC%B1#Chinese) and one of the derived terms is 忧郁的台湾乌龟, or in traditional Chinese, the complete abomination 憂鬱的臺灣烏龜. Just imagine having to hand-write that. And then on the Wiktionary page for this insane term, there's a link in the further reading section to Moegirlpedia. diff --git a/layouts/shortcodes/katex.html b/layouts/shortcodes/katex.html new file mode 100644 index 0000000..d29aa51 --- /dev/null +++ b/layouts/shortcodes/katex.html @@ -0,0 +1,3 @@ + + + diff --git a/layouts/shortcodes/rawhtml.html b/layouts/shortcodes/rawhtml.html deleted file mode 100644 index 59448a1..0000000 --- a/layouts/shortcodes/rawhtml.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Inner }} diff --git a/layouts/shortcodes/sagecell.html b/layouts/shortcodes/sagecell.html new file mode 100644 index 0000000..a9ec247 --- /dev/null +++ b/layouts/shortcodes/sagecell.html @@ -0,0 +1,2 @@ + + diff --git a/layouts/shortcodes/sagescript.html b/layouts/shortcodes/sagescript.html new file mode 100644 index 0000000..339bd8d --- /dev/null +++ b/layouts/shortcodes/sagescript.html @@ -0,0 +1,3 @@ +
+ +