<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>psun.me</title><link>https://psun.me/</link><description>Recent content on psun.me</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Thu, 18 May 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://psun.me/index.xml" rel="self" type="application/rss+xml"/><item><title>The most memorable math problem I've ever done</title><link>https://psun.me/post/quadratic-in-five/</link><pubDate>Thu, 18 May 2023 00:00:00 +0000</pubDate><guid>https://psun.me/post/quadratic-in-five/</guid><description>Sometime in early 2013, I came across the following question:
What are all the solutions to $\sqrt{5-x}=5-x^2$?
To save you the trouble of thinking, the standard approach would be to square both sides and collect the terms, resulting in a quartic equation:
$$x^4-10x^2+x+20=0.$$
You can try evaluating the polynomial at all the factors of 20; none of them are zeros, so the roots of this equation must all be irrational. What do you do?</description></item><item><title>A mathematical analysis of Squid Game, game 5</title><link>https://psun.me/post/squid/</link><pubDate>Fri, 22 Oct 2021 00:00:00 +0000</pubDate><guid>https://psun.me/post/squid/</guid><description>If you haven&amp;rsquo;t heard of Squid Game, please contact me and perhaps I can arrange for a landscaping company to extricate you from the rock you&amp;rsquo;ve been living under. And then read this G-rated, spoiler-free rephrasing of the fifth game from Squid Game so you can understand what the rest of us are talking about (people who have seen the show, hopefully the analogy is obvious):
A teacher has $N$ students and gives each of them the same $M$ question true/false test.</description></item><item><title>Silicon of the 2010s: a retrospective</title><link>https://psun.me/post/silicon-2010s/</link><pubDate>Wed, 19 Aug 2020 00:00:00 +0000</pubDate><guid>https://psun.me/post/silicon-2010s/</guid><description>2011: Intel Sandy Bridge: the last great CPU? The Intel Sandy Bridge family of processors was released in 2011. To understand its legacy, you have to understand the overall performance trend of CPUs the past twenty years&amp;ndash;here&amp;rsquo;s an extremely simplified and subjective plot: Intel&amp;rsquo;s Sandy Bridge microarchitecture was the last one to provide a serious jump in single-threaded performance. From then on, core counts have gone up, but the improvements in per-core performance have been marginal at best.</description></item><item><title>Binary search takes O(∛n) time; geometric bounds in computation</title><link>https://psun.me/post/geometric/</link><pubDate>Sun, 19 Jan 2020 00:00:00 +0000</pubDate><guid>https://psun.me/post/geometric/</guid><description>Welcome to the new roaring twenties! Will this one end like last century&amp;rsquo;s did? Only time will tell!
For now let&amp;rsquo;s focus on something we can analyze more surely: algorithms.
Here&amp;rsquo;s a proof that binary search on an array of length $n$ takes $\newcommand{\cuberoot}[1]{\sqrt[3]{#1}} O(\cuberoot{n})$ time. Just to be specific, here&amp;rsquo;s the pseudocode of the binary search (basically equivalent to C++'s std::lower_bound, which returns the first element greater than or equal to the input) that we aim to prove is $O(\cuberoot{n})$:</description></item><item><title>(Finished) Sunrise Alarm</title><link>https://psun.me/post/sunrise2/</link><pubDate>Mon, 19 Aug 2019 00:00:00 +0000</pubDate><guid>https://psun.me/post/sunrise2/</guid><description>I actually finalized this thing a few weeks ago but haven&amp;rsquo;t had the chance to post until now.
Working with the H801 controller was really smooth and it only took an hour or so to get my app to communicate with the lights. Everything&amp;rsquo;s working now and I use my app every day!
Groovin
I also uploaded the source code to GitHub here.</description></item><item><title>My DIY Sunrise Alarm Clock</title><link>https://psun.me/post/sunrise1/</link><pubDate>Wed, 17 Jul 2019 00:00:00 +0000</pubDate><guid>https://psun.me/post/sunrise1/</guid><description>In the beginning, humans coexisted with nature. Then, we fought to overpower nature. Then, having conquered nature, we sought to bring it back.
Here&amp;rsquo;s how this applies specifically to my sleep:
Waking up to the sun is nice. The time of sunrise and sunset fluctuate as the seasons change, and are almost never in line with my unvarying and semi-nocturnal sleep schedule. So, I use curtains (and specifically, really thick blackout curtains) to prevent the sun from waking me up too early, and an alarm to wake me up when I want to be woken.</description></item><item><title>Turn Gmail attachments to Google Docs to save space</title><link>https://psun.me/post/gdoctor/</link><pubDate>Fri, 15 Feb 2019 00:00:00 +0000</pubDate><guid>https://psun.me/post/gdoctor/</guid><description>I&amp;rsquo;ve been using around 14.9GB of the 15GB Google storage quota for over a year now:
Every time I got really close to the 15GB mark, I&amp;rsquo;d search Gmail or Google Drive for my largest items, find some pretty useless ones, and then delete them. This worked until about a week ago, when I ran out of obvious candidates for deletion. So, I decided to implement an idea I&amp;rsquo;ve had for a while now: a tool that rips attachments out of emails, uploads them as Google Docs/Sheets/Slides (which don&amp;rsquo;t count against the storage quota), and inserts links to the converted documents back in the original email.</description></item><item><title>When typing, your fingers are like a superscalar processor</title><link>https://psun.me/post/cpu-fingers/</link><pubDate>Sun, 06 Jan 2019 00:00:00 +0000</pubDate><guid>https://psun.me/post/cpu-fingers/</guid><description>Imagine that our fingers collectively act as a processor, and this processor executes instructions of the form type x where x is a character on the keyboard. So, to type the phrase hello world, our instruction stream would look like:
type h type e type l type l type o type type w type o type r type l type d What characteristics does this processor have, and how does this processor relate to the ones found in our computers?</description></item><item><title>FFT-Based Integer Multiplication, Part 2</title><link>https://psun.me/post/fft2/</link><pubDate>Tue, 20 Nov 2018 00:00:00 +0000</pubDate><guid>https://psun.me/post/fft2/</guid><description>In the first half of this article we discussed convolution, using FFT for convolution, and the difficulties associated with using floating-point numbers when exact integer output is required. This second half of the article is about the Schonhage-Strassen algorithm for fast integer multiplication. It multiplies $N$ bit integers in $O(N\log N\log\log N)$ time via a modular arithmetic based FFT, known as the number theoretic transform (NTT). Schonhage-Strassen is no longer asymptotically the fastest, but it held the title for over thirty years, and its ideas form the basis for newer algorithms that slightly reduce the runtime.</description></item><item><title>FFT-Based Integer Multiplication, Part 1</title><link>https://psun.me/post/fft1/</link><pubDate>Fri, 19 Oct 2018 00:00:00 +0000</pubDate><guid>https://psun.me/post/fft1/</guid><description>The convolution of two discrete, finite, length-$N$ signals $f$ and $g$ (basically two length-$N$ arrays) is denoted $f*g$. The result $f*g$ is also a length-$N$ signal, with
$$(f*g)[n]=\sum_{m=0}^{N-1}f[m]g[n-m]$$
Convolutions appear in many applications:
Multiplication: Let $f$ and $g$ be the coefficient arrays of two polynomials, so $f[n]$ is the coefficient for the $x^n$ term. Then $(f*g)[n]$ equals the coefficient on the $x^n$ term when we multiply our polynomials (plus a wrapping effect, discussed later).</description></item><item><title>Markov Chains, Beyond the Mean</title><link>https://psun.me/post/markov/</link><pubDate>Tue, 02 Oct 2018 00:00:00 +0000</pubDate><guid>https://psun.me/post/markov/</guid><description>Here&amp;rsquo;s an example of a typical Markov chain problem: say there&amp;rsquo;s a four-sided die. You keep rolling this die until your current roll comes up with a 2 and your previous roll was a 1. Let $R$ equal your number of rolls. What is $E[R]$?
This problem can be modeled as a Markov chain with 3 states:
In this Markov chain, $s_2$ corresponds to being finished (your past two rolls were a 1 then a 2, in that order); $s_1$ corresponds to being partly done (you just rolled a 1 and are now hoping for a 2), and $s_0$ corresponds to no progress (still hoping to roll a 1).</description></item><item><title>The Poisson, Exponential, and Uniform</title><link>https://psun.me/post/poisson1/</link><pubDate>Thu, 20 Sep 2018 00:00:00 +0000</pubDate><guid>https://psun.me/post/poisson1/</guid><description>Until recently, I had trouble remembering the pdf of the Poisson distribution. The expression
$$\dfrac{e^{-\lambda} \lambda^n}{n!}$$
didn&amp;rsquo;t make much sense to me. I knew the Poisson could be derived as the limit of the binomial distribution, but that didn&amp;rsquo;t help my memory much.
Here&amp;rsquo;s an alternative method of deriving the Poisson&amp;rsquo;s pdf that I personally find much more intuitive. Suppose we have a Poisson process with parameter $\lambda$, and let the hits of this process occur at $t_1, t_2, &amp;hellip;$ Define $d_i$ as the wait time between hits:</description></item><item><title>Hello from my blog</title><link>https://psun.me/post/hello-blog/</link><pubDate>Wed, 12 Sep 2018 00:00:00 +0000</pubDate><guid>https://psun.me/post/hello-blog/</guid><description>It&amp;rsquo;s a static site I ran a few WordPress sites back in high school and I was never very thrilled by the experience. The site was kind of slow, unless you installed one of those random &amp;ldquo;WordPress caching&amp;rdquo; plugins that usually did their job, but sometimes broke things. Every half a year or so, I&amp;rsquo;d update my WordPress installation (the alternative was facing exposure to unpatched exploits) and pray my plugins worked and the formatting didn&amp;rsquo;t break.</description></item></channel></rss>