<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://blog.vinaybhaip.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.vinaybhaip.com/" rel="alternate" type="text/html" /><updated>2026-03-20T03:44:03+00:00</updated><id>https://blog.vinaybhaip.com/feed.xml</id><title type="html">Refined</title><subtitle>A deepdive into the thoughts of a young computer scientist.</subtitle><entry><title type="html">A Year of Whoop</title><link href="https://blog.vinaybhaip.com/2026/03/19/year-of-whoop" rel="alternate" type="text/html" title="A Year of Whoop" /><published>2026-03-19T00:00:00+00:00</published><updated>2026-03-19T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2026/03/19/year-of-whoop</id><content type="html" xml:base="https://blog.vinaybhaip.com/2026/03/19/year-of-whoop"><![CDATA[<p>I just crossed a year of using <a href="https://whoop.com">Whoop</a> and spent some time reflecting on what I’ve learned. In case you don’t know, Whoop is a fitness monitor that tracks your heart rate giving you insights on how well you slept, how hard you exerted yourself during exercise, how much your body recovered, etc.</p>

<p>One of my principles is to invest in my health, so it felt worth the cost. I really like that I can wear it on my bicep, rarely have to charge it (once every two weeks), and it doesn’t have a screen.</p>

<p>Here are some things I’ve learned:</p>

<h4 id="hours-of-sleep-is-important">Hours of sleep is important</h4>
<p>I remember there was a period of a couple of months when I felt perpetually tired. Whoop was showing I had a large sleep debt during this time, a metric  that tracks the accumulation of how much sleep you got relative to what you needed. I remember when I started to sleep more (and paid off this sleep debt), I felt more energy during the day. I was no longer drifting to sleep on my subway rides and instead reading books.</p>

<p>The correlation is pretty strong; whenever I feel groggy, it’s usually because I didn’t get the best sleep the night before. I’m now really opposed to red-eye or early-morning flights; I’m willing to pay a premium to avoid them.</p>

<p>I also have noticed that when I don’t sleep properly, my willpower is significantly weaker. If I’m not fully rested, I’m more likely to cave in and eat unhealthy food, get distracted at work, and falter on maintaining habits that I’m building. I also think sleep deprivation makes me less kind and motivated than I strive to be; it’s like I revert to factory settings.</p>

<p>A lot of my beliefs on sleep also come from <em>Why We Sleep</em>, a great book that emphasizes sleep as the foundation for nearly everything - it’s worth a read.</p>

<h4 id="quality-of-sleep-is-important">Quality of sleep is important</h4>

<p>Quality of sleep is just as important as hours of sleep. I’ve noticed that lowering my resting heart rate really helps sleep quality. Concretely:</p>
<ul>
  <li>Drinking destroys sleep quality. This is obvious, but it kind of surprised me just how bad it is. Funny story: someone I know had their Whoop for some time and said it made them feel bad about drinking so they got rid of their Whoop 😅</li>
  <li>Running or any cardio intensive exercise late in the day can make it really hard to sleep. I once did a long run a few hours before sleeping and I distinctly remember lying in bed unable to sleep; I was so tired, but I couldn’t for the life of me get my heart rate down. I now try to avoid heavy runs at night and don’t run at all within 3 hours of falling asleep.</li>
  <li>Eating a heavy dinner significantly ruins my sleep. I think this is because your body is spending a lot of energy processing the food. I skipped dinner for a few months, and I had really great sleep during that time. Now, I try to keep dinners smaller and earlier in the night.</li>
  <li>I sleep in a really cold room, which apparently is good for sleeping. I take a hot shower at night, which I also think helps, but I’m not too sure.</li>
  <li>I’ve found reading books, playing the guitar, and not using my phone within an hour of bedtime to be useful for lowering my heart rate.</li>
</ul>

<h4 id="worse-sleep-is-sometimes-worth-it">Worse sleep is sometimes worth it</h4>

<p>After a few months of having my Whoop, I started becoming a little too obsessive over it. There were moments when I’d be out with friends and think to myself “oh my god my recovery is going to be so low tomorrow” (yes I was that person). It’s good to prioritize my health, but over-indexing on it is probably not the best. In a way, the act of optimizing can itself be suboptimal.</p>

<p>I now treat a worse recovery/sleep as debt. This has a bad connotation, but sometimes, you really do want to take on debt. Having a drink or two and staying up with friends has made me happier and more fulfilled than getting perfect sleep every night. It’s about balance - you just can’t make this trade every day.</p>

<h4 id="these-metrics-are-kind-of-obvious">These metrics are kind of obvious?</h4>

<p>You might think it’s kind of obvious: when you sleep less, you are tired. And you’d be right; I think a lot of these insights aren’t really that deep. Also, some of these metrics might be more gimmicky/less accurate.</p>

<p>I find though that it’s easy to lie to yourself and ignore the importance of sleep and rest. Yes, you can always just listen to your body, but you’re much more likely to follow through if you see concrete numbers. Even if the metrics aren’t fully accurate, it’s at least a good estimation that is better than you guessing.</p>

<hr />]]></content><author><name></name></author><summary type="html"><![CDATA[Reflections from tracking my sleep and recovery for a year.]]></summary></entry><entry><title type="html">Inconveniencing Others</title><link href="https://blog.vinaybhaip.com/2026/03/15/inconveniencing-others" rel="alternate" type="text/html" title="Inconveniencing Others" /><published>2026-03-15T00:00:00+00:00</published><updated>2026-03-15T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2026/03/15/inconveniencing-others</id><content type="html" xml:base="https://blog.vinaybhaip.com/2026/03/15/inconveniencing-others"><![CDATA[<p>Something that makes me sad is when people say “oh I didn’t want to bother you” or “so-and-so is probably busy so I won’t invite them”. I think there’s a culture of politeness and fear of rejection that makes us more inclined to avoid interactions. This is something I’ve been pushing back against this year. Here are some examples of what I mean:</p>

<ul>
  <li>I was at a coffee shop that my friend recommended a long time ago and I didn’t know what to get. I knew my friend was studying for a test and it was a kind of dumb thing to do, but I called him for a few minutes to get his recs. Obviously, I can just pick something, but I feel like calling him makes him a part of my life in the present.</li>
  <li>When I’m walking on the street, if I see somebody has a cool jacket or glasses or anything, I tell them. If someone is reading a book that looks interesting, I ask them what they think about it. I don’t want to live in a world where everyone keeps to themselves.</li>
  <li>If someone invites me to something, I try my best to show up. I don’t let my mind convince me that they didn’t really want to invite me (especially if I don’t know them that well) – I don’t view my presence as an inconvenience to others.</li>
</ul>

<p>On a related note, if I have a question, I try to call people – even if I know they might be busy. If they don’t pick up, it’s fine. I’m trying to get out of the mindset where I’m embarrassed if somebody doesn’t pick up. Anytime someone calls me, I’m always touched that they put aside time and thought about me.</p>

<p>This isn’t an absolute. There are social cues you can take, and it can become too much (see <a href="https://blog.vinaybhaip.com/2025/11/30/on-advice">On Advice</a>), but I often feel like we don’t share our lives with others enough.</p>

<blockquote>
  <p>The world is held together, really it is held together, by the love and the passion of a very few people.</p>

  <p>James Baldwin</p>
</blockquote>

<p>And on this note, don’t let others not taking the same initiative deter you – you should do it without expecting anything in return. I like to think that my small part makes ripples that propagate and compound over time.</p>

<p>If you’re romantic about life, it’s on <em>you</em> to make that romance a reality. Host dinner parties. Plan the next road trip. Play your guitar in the park.</p>

<p>Some folks won’t be the catalyst to make life more romantic, but that’s all the more reason for you to take the initiative.</p>

<p><br /></p>

<p>(As I was writing this, the stranger sitting next to me on the train started a conversation with me and “inconvenienced” me. The universe works in mysterious ways 😁)</p>

<hr />]]></content><author><name></name></author><summary type="html"><![CDATA[The case for bothering people.]]></summary></entry><entry><title type="html">A Lossless Transfer of Experiences</title><link href="https://blog.vinaybhaip.com/2026/01/04/lossless-experience-transfers" rel="alternate" type="text/html" title="A Lossless Transfer of Experiences" /><published>2026-01-04T00:00:00+00:00</published><updated>2026-01-04T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2026/01/04/lossless-experience-transfers</id><content type="html" xml:base="https://blog.vinaybhaip.com/2026/01/04/lossless-experience-transfers"><![CDATA[<p>I was recently thinking about how language fails to express so much of what we experience. If I tell you everything about how an apple tastes—the crisp as your teeth dig into the skin and the juices coating your taste buds—you would still never truly understand what it’s like if you have never eaten an apple. You may get a rough idea, but it is drastically different. In this way, words (no matter how we string them together) can never capture the experience of eating an apple or frankly most experiences.</p>

<p>You could think of the experience of eating an apple as existing in $n$ dimensions, while any language representation exists in $m$ dimensions, where $m \ll n$. We can project the experience of eating an apple from $n$ dimensions to the $m$ dimensions of language, but you lose so much information. This is true of any other representation—images, videos, and audio.</p>

<h4 id="a-thought-experiment">A Thought Experiment</h4>

<p>What if there was some medium to fully represent experiences? Let’s say there exists some technology that is able to transfer person A’s experience to person B. Some rules and restrictions:</p>
<ol>
  <li><strong>Time</strong>: It takes the same amount of time for Person B to gain this experience as Person A took to originally have this experience. Person B cannot gain an experience in the snap of their fingers.</li>
  <li><strong>Asynchronous</strong>: Person A doesn’t necessarily have to be present at the same time as Person B. You could imagine that Person A uploads their experience to some device, which is stored and can be transmitted to others at another point in time.</li>
  <li><strong>Preservation</strong>: Person A doesn’t need to necessarily “record” any of their experiences. If they remember it, they can access it for other people to experience. Obviously, memories decay over time, but in this world we’ll assume Person A still holds a preserved version of the original experience.</li>
  <li><strong>Non-parallelism</strong>: Person B can only have one experience transerred to them at a time.</li>
  <li><strong>No knowledge transfers (i.e. defining an experience)</strong>: Person A cannot directly transfer knowledge to Person B. I define an experience as a person’s response over a time period to stimulus from the world. The act of learning something (which would qualify as an experience) can be transferred to Person B, but because of (1), this essentially is the same as just learning yourself.</li>
</ol>

<p>An example: Person A climbs Mount Everest and sees these incredible views. Person A uploads the experience of summiting Everest (suppose the final ten minutes). Person B downloads this data, replays it, and goes through the same experience of summitting Everest. Person B experiences everything—the adrenaline rush, the feeling of accomplishment, the pain, and the reward—all while sitting at home.</p>

<h4 id="what-does-the-world-look-like-with-this-technology">What does the world look like with this technology?</h4>

<p><strong>The world becomes more empathetic.</strong>
I think most, if not all, disagreements stem from the different ways people have had their values shaped by past experiences. If this technology exists, core experiences that shaped people into who they are can now be accessible to others. People are able to connect more with each other; empathy feels close to solved. If someone doesn’t understand where someone else is coming from, experience transfer should greatly help.</p>

<p><strong>Academic progress grows.</strong>
The restrictions of no direct knowledge transfers (5 from above) significantly hampers the ability to make exponential scientific progress. But sharing experiences still should allow for those at the top of their fields to share creativity. You could imagine a physicist sharing their experience of solving some equation to another scientist and perhaps the chain of thinking can be applied to biology. Connections that were once stumbled upon now are much more common.</p>

<p><strong>Experiences become commoditized.</strong>
Capitalism inevitably kicks in and people at the top of their crafts sell their experiences to others. For example, a person who recently skied down Everest for the first time sells their experience, sharing all the thrill with none of the risk. There is now a catalog for experiences you can peruse through; some people/companies have monopolies over certain experiences which naturally would be worth a lot. The more people who have done an experience, the cheaper it is. There becomes a select few groups of people who risk themselves to explore new unique experiences for the rest to enjoy.</p>

<p>People begin to prefer most forms of hedonistic pleasure through this experience machine instead of experiencing it themselves. Why would you ever go on a roller coaster and take the risk of something going wrong when you can get the <em>exact</em> same pleasure from the machine? You’d prefer the machine for many reasons: a) safety, b) guaranteed pleasure (no chance you get dizzy or throw up), and c) the ability to do it while sitting at home.</p>

<p>This applies to many areas. Why would you eat unhealthy food that clogs your arteries when you can eat healthy but still enjoy the taste of a perfectly cooked fried chicken sandwich through the machine? Why would you drink when you can protect your liver and still feel buzzed? Why would you step out of the house to soak in sunshine when you can protect your skin and feel the warmth while sitting inside? The experience machine lets you avoid all risk and gain the upside.</p>

<p><strong>Individualism becomes less important.</strong>
Since experiences are transferrable, they become devalued. The world eventually converges on a set of experiences that bring the most utility for people, so experiences are no longer unique. Any experience can now be experienced by all of humanity, which makes people appear more as a collective. Having your own imperfect experience that makes it uniquely you is harder to justify when you can get a better, curated experience.</p>

<p>Empathy is great, but I worry that this world leads to one where people lose their identity. If you hold onto your own core experiences, not sharing them with others, you’re at a disadvantage because you cannot connect with others as deeply and easily. So the trade-off becomes whether you value your individualism or your community.</p>

<p><br /></p>

<p>Something about this makes me sad. It feels like this world devalues your own experiences. Maybe it’s a good thing that language doesn’t capture everything we’re feeling? Maybe the ideal world is one where experience transfer lets you feel 80–90% of the experience, enough for empathy, while still preserving the incentive to create your own.</p>

<hr />]]></content><author><name></name></author><summary type="html"><![CDATA[Exploring what the world would look like if we could transfer experiences.]]></summary></entry><entry><title type="html">On Advice</title><link href="https://blog.vinaybhaip.com/2025/11/30/on-advice" rel="alternate" type="text/html" title="On Advice" /><published>2025-11-30T00:00:00+00:00</published><updated>2025-11-30T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2025/11/30/on-advice</id><content type="html" xml:base="https://blog.vinaybhaip.com/2025/11/30/on-advice"><![CDATA[<p><strong>What advice should you follow?</strong></p>

<p>So much advice people give is contradictory: in your 20s, you should travel the world, but also in your 20s, you should focus on your career. Don’t let things affect you, but also don’t be a pushover. If you’re failing at something, keep pushing through, but also, maybe it’s time to let go.</p>

<p>I’ve come to realize that most advice isn’t an absolute on what you should do, but rather a vector that pulls you in some direction. Take the contradictory advice of either pushing through or knowing when to give up when facing adversity. Let’s quantify this on a scale where a 1 means you give up right away when you fail and a 10 means you keep persisting no matter what. The advice of pushing through is less of a statement saying you should be a 8 or a 9 or a 10, but more of a statement pulling you towards a 10 - a vector rather than a scalar. Likewise, the advice of letting go is a statement pulling you towards a 1.</p>

<p>When you frame it like this, it makes more sense how both of these advices can be true. Let’s say the optimal value of where you should be on this scale is a 7 (which means pushing through adversity most times, but giving up if you fail too much). If you’re currently at a 6, then the advice of pushing through is helpful to hear. But if you’re currently at an 8, then the better advice is letting go.</p>

<p>Advice is rarely good or bad; it’s context-dependent. If you read some advice online or from a talk intended for a wide-ranging audience, it’s not really useful since they don’t know where you are. The lessons they learned made them come up with an advice vector that worked for them; it doesn’t mean it’ll work for you.</p>

<p>Even if your friend is telling you advice, it’s usually originating from their experience: advice that they wished they had heard. Their advice becomes relevant only if they know and deeply consider where you are now. It’s also iffy because maybe the optimal value on the scale for them could be different than for you.</p>

<p>I think that when receiving advice, you should consider where you are on the scale and where you want to be. You should think about if the person giving this advice knows where you are on the scale and where you want to be. Otherwise it’s a shot in the dark.</p>

<p><strong>Experiences &gt; Advice</strong></p>

<blockquote>
  <p>Here’s the thing about mistakes. Sometimes, even when you know something’s a mistake, you gotta make it anyway</p>

  <p>Ted Mosby</p>
</blockquote>

<p>Sometimes I make the “wrong” decision, even though I know it’s wrong. When I was a kid, I loved the scent of vanilla. Ice cream, cake, every dessert uses vanilla, so I thought tasting vanilla extract by itself would be just as good. My mom told me that it didn’t work like that; you have to add it to something you bake. Obviously, she was right. I didn’t listen, tasted it, and immediately regretted my decision.</p>

<p>The supposed rational response here would’ve been to listen to my mom. She has much more experience than me and has no reason to lie. But I don’t think the lesson here is to always listen to those with experience. The lesson is that visceral experiences always have more of an impact than advice. You can tell me what hiking the Swiss Alps is like, showing me pictures, recordings, and souvenirs, and I still will not fully understand until I go myself.</p>

<p>For things to truly stick, it needs to be visceral. No quote is going to give you that feeling. Even if you know some advice is true, sometimes you’ll do the opposite of it, and that’s okay.</p>

<p>There’s also something to be said regarding exploration and exploitation; you should try deviating once in a while even when you have advice that you think is true.</p>

<p><strong>Executing</strong></p>

<p>I’m wary about the culture surrounding advice these days. It feels like people (myself included) collect aphorisms instead of acting upon them. Reading about advice and quotes gives you the illusion of progress. At some point, you have to execute.</p>

<p>I’m now a lot more skeptical about self-help books. Everything they say can be true, but how much of it is really impactful? It isn’t visceral and can be harmful by making you feel as if you’re being productive without doing anything.</p>

<hr />]]></content><author><name></name></author><summary type="html"><![CDATA[Advice is a vector, not a goal.]]></summary></entry><entry><title type="html">Optimizing Happiness</title><link href="https://blog.vinaybhaip.com/2025/08/01/optimizing-happiness" rel="alternate" type="text/html" title="Optimizing Happiness" /><published>2025-08-01T00:00:00+00:00</published><updated>2025-08-01T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2025/08/01/optimizing-happiness</id><content type="html" xml:base="https://blog.vinaybhaip.com/2025/08/01/optimizing-happiness"><![CDATA[<p>When people say you should maximize happiness, what does that mean? Let’s say we’re measuring happiness in a unit called utils<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>. If you only maximize utils right now, well, you’d probably just take drugs. This doesn’t seem like a good idea; we care about our future happiness too. So maybe you think it’s not your happiness at this one moment, but it’s your happiness over time.</p>

<p>This additional dimension of time makes things a lot more complicated. How do we compare our happiness in the future to what we have right now? One simple way to think about this is to take the area under the curve if we plot utility against time<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup>.</p>

<p><img src="/assets/images/optimizing-happiness/single-moment.jpeg" alt="Happiness curve at moment" />
<em>A graph of utility. At the present moment (the red dotted line), we maximize our happiness but we ignore the consequences of the future.</em></p>

<p>vs.</p>

<p><img src="/assets/images/optimizing-happiness/auc.jpeg" alt="Happiness curve area under curve" />
<em>The area under the curve — more precisely the area between the curve and the baseline axis, where it contributes negatively when below it.</em></p>

<p>This lines up with the intuition that we care about the future. But something about this still feels wrong. Look at these two utility curves:
<img src="/assets/images/optimizing-happiness/same-area.jpeg" alt="Happiness curves with same area" /></p>

<p>Both curves cover the same area, so should we be indifferent between them? Probably not. The increasing pink line seems like a more favorable life, because we’re constantly improving. It seems that while we care about the area under the curve, what we <em>perceive</em> in each moment is how our utility compares to what it was before and that has an effect on our original utility.</p>

<p>Maybe what we value here at any moment $x$ is roughly $f(x) - f(x - \epsilon)$ for some $\epsilon$ look-back period. One way I visualize this is that the axes themselves move at a delayed rate relative to where you currently are.</p>

<p><img src="/assets/images/optimizing-happiness/shifting-baseline.jpeg" alt="Happiness curves with shifting baseline" />
<em>If $\epsilon$ was 1 day, this is saying every day, you perceive your happiness relative to how you felt the day before</em></p>

<p>So at any moment in time, you move your axes to be centered around where you were at $x-\epsilon$ and evaluate your position then. This is roughly the same as considering $f’(x)$.</p>

<p>Now some people might point out that a true utility curve already bakes this information in, which is valid. I make this distinction: the original utility curve is what it would be if you never thought about your happiness and just went along life. My argument here is that the perception of your utility curve affects your utility itself. This means we really should be considering $f(x) + \alpha \cdot f’(x)$ for some factor $\alpha \geq 0$.</p>

<p>You can go down this rabbit hole again and say that you care about the acceleration at which your happiness is improving, roughly $f^″(x)$, which means your real utility is $f(x) + \alpha \cdot f’(x) + \beta \cdot f^″(x)$  with $0 \leq \beta$ and probably $\beta « \alpha$. You can keep extending this, but people probably don’t think beyond the second derivative of their happiness (I certainly don’t).</p>

<p>I feel for most people (at least me), $\alpha$ is pretty large ($\beta$ is pretty negligible). We often compare happiness to the past—talking about “the good old days” or reminiscing about the past. Being present and exercising gratitude lowers $\alpha$ by realizing that all that really matters is how we feel in the moment<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup>.</p>

<p>I think, though, it’s pretty hard to get $\alpha$ low. It’s already hard enough to avoid comparing yourself to others (and often, the advice given is “compare yourself to where you were before, not to others”). So given $f’(x)$ is a non-negligible term, how do we optimize happiness?</p>

<p>Integrating the new happiness model gives $(\int_0^1 f(x) dx)+ \alpha \cdot (f(1) - f(0))$, assuming your life is lived on $x \in [0, 1]$. This is the same as the area under the curve plus an additional term for how much we’ve changed in absolute utility. What this is to say is that the overall growth of your happiness matters here, according to some $\alpha$.</p>

<p>Now this might be a duh result, but I feel like writing this out helps justify some of my beliefs. One thing I believe is that the correlation between wealth and happiness isn’t that large, after some point<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup>. Even if billionaires have more absolute utils than I do due to their wealth, if $\alpha$ is high, they might not be that much happier because of the perception that their happiness is stagnating. Thinking back to the moving axes example, no matter how much “absolute” utility they gain, the baseline is always resetting. I think this also holds true for the reverse direction—it reconciles how people with significantly less money still have lives that feel just as happy as others.</p>

<p>This also explains why lifestyle inflation isn’t super great; you’re optimizing for the short-term, but the baseline is going to keep resetting.</p>

<p>That said, I think there’s too much of an emphasis on optimization, so I definitely don’t/wouldn’t think about every action I do through this lens. But I think it gives interesting heuristics on how to view your life. Maybe you also come to different results if you take different assumptions. For example, there’s no fundamental reason to prefer the area under the curve; perhaps you care about maximizing the minimum happiness.</p>

<p>Maybe this post is also just a way to combine my love for math and philosophy 😁</p>

<hr />
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Some might argue that happiness can’t be measured, but I think there’s legitimate ways like the number of dopamine molecules released in your body. Obviously no one is calculating this, but it must be true that utility can be somewhat be measured and compared. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>Measuring the area under the curve might make you uneasy because there’s a lot of uncertainty as time passes on how many utils you might have in the future at any given moment. Let’s just take it from a birds-eye view as if we’re objectively trying to quantify the utility from someone’s life. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>$\alpha$ being high isn’t always bad though! If $f’(x)$ is large, maybe having a high $\alpha$ is great. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:4" role="doc-endnote">
      <p>Obviously having money solves problems and is useful. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[Thinking about happiness mathematically.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.vinaybhaip.com/assets/images/optimizing-happiness/auc.jpeg" /><media:content medium="image" url="https://blog.vinaybhaip.com/assets/images/optimizing-happiness/auc.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Balancing Drive and Presence</title><link href="https://blog.vinaybhaip.com/2025/07/20/balancing-drive-and-presence" rel="alternate" type="text/html" title="Balancing Drive and Presence" /><published>2025-07-20T00:00:00+00:00</published><updated>2025-07-20T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2025/07/20/balancing-drive-and-presence</id><content type="html" xml:base="https://blog.vinaybhaip.com/2025/07/20/balancing-drive-and-presence"><![CDATA[<p>Lately, I’ve been feeling like there’s a trade-off between drive and presence. Drive, I’m using in the sense of purpose: having a cause that you want to work relentlessly towards. It’s something that gives you a deep sense of fulfillment; you love the process. For some people, it’s building a startup, for others it’s training for a marathon. What’s common to these is a desire to be one of the best and to “make it”. <sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup></p>

<p>Presence, I’m using in the sense of inner peace. It’s slowing down to smell the roses—looking around yourself and being in childlike awe of the world. It’s being content and grateful for what you have.</p>

<p>Maybe it’s how I defined these words, but they’re fundamentally at odds with each other. Having drive and purpose stems from a lack of satisfaction with the present. Slowing down and enjoying what you have in the present takes away from your ability to hyper-focus on your goals. Drive is about motion, presence is about stillness. <sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<p>Growing up, I’ve always had this fire inside of me to make it—there was something I had to prove to others. I distinctly remember saying once, “I want the history of the world to feel incomplete if it didn’t include me”.</p>

<p>And now, I think I’m on the opposite side of the spectrum. I’m focused on how I feel and how I can affect the ones closest to me. I’m taking time to slow down and be grateful for the present. I’m not amazing at it, but I’ve worked hard to get here, and I keep at it. <sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup></p>

<p>This sounds great, but there’s always something that tugs at me: I’ve been given the opportunity to live life, and I know I have the potential, so why squander it? Is producing something valuable for the world at the price of my peace worth it?</p>

<p>When I reflect, I think the <em>intention</em> behind your drive matters. Drive should be less about proving something to others and feeling like you’ve made it. It should be something that calls to you. Something that makes you want to drift off from the serenity of presence. I think back to some of the cool projects I did in my free time in high school and earlier; they never were things I did as an end; I loved the process. It was an idea in my head that I just <em>had</em> to do.</p>

<p>And finding that drive isn’t something that walks into your lap. You’ve got to branch out a little bit to find it, getting out of your comfort zone. And when you find it, it’s okay to lose your presence—frankly, once you’ve had a taste of it, there’s no going back.</p>

<hr />
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>I know this isn’t exactly what purpose is—I’m using it as a placeholder for an uncontrollable desire to be a part of something bigger than yourself. People find purpose in a lot of things—raising a family for example; I’m more interested in the intersection with drive. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>As an aside, it’s very plausible to have no drive <em>and</em> no presence—being caught up in everyday things and not pushing yourself for something bigger. For that reason, I see these two concepts as strongly negatively correlated, but not opposites of each other. On a 2D plane, if presence is $\widehat{x}$, then purpose isn’t $-\widehat{x}$, rather $-\widehat{x}+\epsilon \cdot \widehat{y}$ (normalized). <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>I love <a href="https://www.youtube.com/watch?v=K0yqlInedZM">this short video</a> I came across some time ago; it talks about the need to justify our existence to others, something I felt captured a core belief of mine, at least before. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[The tension between ambition and contentment.]]></summary></entry><entry><title type="html">Lessons from a Year Abroad</title><link href="https://blog.vinaybhaip.com/2024/08/03/lessons-from-abroad" rel="alternate" type="text/html" title="Lessons from a Year Abroad" /><published>2024-08-03T00:00:00+00:00</published><updated>2024-08-03T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2024/08/03/lessons-from-abroad</id><content type="html" xml:base="https://blog.vinaybhaip.com/2024/08/03/lessons-from-abroad"><![CDATA[<p>Over the past year, I completed my Masters in Math at Oxford, traveling through the world along the way. It was an incredibly rewarding experience that led to a lot of personal growth, and I wanted to capture some of the biggest lessons I took away.</p>

<h2 id="why-did-i-do-a-masters-at-oxford">Why did I do a Masters at Oxford?</h2>

<p>When I was doing my undergrad at UVA, I knew I’d be graduating a year early. The plan had always been to stay for an extra year for my Masters. I cared about doing a Masters because I wanted the traditional four year college experience.</p>

<p>In my final year at UVA, a professor gave a lecture about how he left his undergrad to study in South Africa for a year and how it was the best decision he made in his life – getting out of his comfort zone and turning off autopilot. This talk really struck a chord with me and made me look into programs outside of UVA.</p>

<p>I settled on doing my Masters of Math in Oxford for a couple of reasons:</p>
<ol>
  <li>It would be a completely different experience in a new country.</li>
  <li>It was in math, something I always enjoyed academically, but wanted to strengthen. I realistically would never get the chance to do math in an academic setting in the near future, so spending a year purely on it excited me.</li>
  <li>I would get to travel a lot.</li>
  <li>It was only a one year program, so it fit into my timeline for starting fulltime work at the same time as my friends.</li>
</ol>

<h2 id="lessons-ive-learned">Lessons I’ve Learned</h2>

<h4 id="getting-out-of-my-comfort-zone">Getting Out of My Comfort Zone</h4>

<p>When I got off the plane in the UK for the first time, I was excited for a new adventure, but I would be lying if I said I wasn’t terrified. The idea of just being in another country without anyone I knew was deeply uncomfortable, but as all things in life, the only way was forward. Even in a country where I originally knew no one, I made close friends from across the globe. Figuring out visas, bank accounts, phone numbers, etc. was hard, but it all worked out – it made me appreciate what immigrants go through even more.</p>

<p>In my time abroad, I got to visit over ten countries. In the past, I never had to book my own flights, figure out where to stay, and create a daily schedule all by and for myself. At first it was scary, but after that initial hump, it turned out to be so much fun. I realized how different cultures and ways of living compared to the US. I loved what each country brought to the table: the food, the traditions, the people, but one big takeaway was how much I took all the privileges from living in the US for granted. The cultural aura that the US exuded on the rest of the world made me feel even more pride for my home.</p>

<p>On the academic side, Oxford math challenged me in many ways. While one of my majors at UVA was math, I never truly felt like a math person before - it was always as if math was only something on the side I was interested in.</p>

<p>In most European universities, students only take classes in their major; for example, math undergrads at Oxford only studied math, whereas in the US, I was taking breadth courses that interested me ranging from lectures on carbon neutrality to the history of hip-hop. While I’m glad to have had the US undergrad experience, in my masters classes, I could definitely feel the imposter syndrome creeping in, especially with the faster pace of lectures.</p>

<p>One big lesson I learned was that I’m more capable than I give myself credit for; once I sat down for a few hours and reasoned through the material, I would feel pretty solid. Everyone has different routines for learning; some friends of mine would spend the entire day in the library, but that wouldn’t work for me – I often needed time for my brain to relax. Trusting my own process and the way I learn best worked out pretty well and I ended up doing great on my exams.</p>

<h4 id="enjoying-solitude">Enjoying Solitude</h4>

<p>My friends would often stay home during the breaks, but I wanted to travel, so I dived into the realm of solo-traveling. It was something a few of my friends back home had raved about, and I would always say, “Man, I wish I could do that.” This year that mentality changed.</p>

<p>I saw so many different cities in Europe while staying in hostels, and I realized how much I loved solo-traveling. It felt freeing – I could do whatever I wanted (it was usually bakery hopping and journaling). I think fondly about that time: having no responsibility and just living. I distinctly remember sipping hot chocolate along a river in Ghent, Belgium, thinking, “I know nobody in this country.” It didn’t scare me, it felt like an escape from the woes of every day life.</p>

<p>I love hanging out with friends, but having time to myself made me introspective and appreciative for everything in my life. I hope to incorporate more time to do that, even when I’m not roaming the streets of Europe.</p>

<h4 id="staying-closer-to-home">Staying Closer to Home</h4>

<p>Everybody talks about how you make amazing friends abroad, and I did, but the ones back home got me through the year. This year, I put an effort to stay close with people who I cared about – it was something I told myself I’d do when studying abroad, and I’m glad I stuck with it (see my project <a href="https://vinaybhaip.com/blog/2024/03/24/sealed">Sealed</a>). I’ve realized the results of compounding investments into relationships; I feel like I’ve gotten closer to friends back home by calling them every two weeks or so, even without being there in person. Had I not put in the effort, I realistically could have lost touch. I’m reminded of one of my favorite quotes from How I Met Your Mother:</p>

<blockquote>
  <p>You will be shocked, kids, when you discover how easy it is in life to part ways with people forever. That’s why, when you find someone you want to keep around, you do something about it.</p>
</blockquote>

<p>I never went home to the US in my year abroad; it might be the longest I’ll ever go without returning home. This was an intentional choice to force me to travel and explore where I was, and while I have no regrets, I think visiting home once might’ve been nice. It was tough at times, but honestly not as bad as I would’ve thought. That’s because I didn’t really feel like my friends from home left. I’m so grateful for them: the ones who visited me and the ones I could call whenever and debrief about life updates.</p>

<h4 id="how-to-cook">How to Cook</h4>

<p>One of the best parts of being in a European city like Oxford was how walkable it is. The grocery store was a five minute walk from my room, which made cooking really convenient, unlike my undergrad where I would need a car (which I had to rely on my roommates for). Cooking was just like anything in life; the more time I spent on it, the better I got – I was so impressed with how good food could taste. I’d be up late at night watching videos on the Maillard reaction and experimenting the next day like a scientist. I learned so much about the value of getting a good sear and using spices and marinades.</p>

<p>Cooking also made me appreciate even more the food I was consuming. Instead of just eating food and thinking it tasted great, I now think about what individual flavors combine to make me feel this way – for example, what are the different sources of salt and how do the different textures in the dish contribute to the overall experience? I’ll definitely miss being able to cook so often and having ingredients so readily accessible.</p>

<h4 id="getting-in-shape">Getting in Shape</h4>

<p>While studying was important at Oxford, I prioritized going to the gym and eating healthy, which I admittedly was not the best at during my undergrad. The result was night and day; I could confidently say I was in the best shape of my life and hope to add to the momentum I built up. I realized that having a gym a two minute walk away was an incredible motivator for working out. I was able to complete <a href="https://themurphchallenge.com">the Murph</a> (without the weight belt… that will change soon) and now want to keep it as a yearly tradition. Consistently going to the gym revealed how hard work compounds over time; previously, I kept switching my routines and questioning if I was heading in the right direction. What I didn’t realize is that the most important thing about your gym routine is sticking to it.</p>

<p><br /></p>

<p>Going abroad meant missing so many events back home and the FOMO was real. But I wouldn’t change any of it for the growth I experienced and the person I became.</p>

<hr />]]></content><author><name></name></author><summary type="html"><![CDATA[What studying in the UK taught me about life.]]></summary></entry><entry><title type="html">Sealed: Custom Wax Seal NFC Tags</title><link href="https://blog.vinaybhaip.com/2024/03/24/sealed" rel="alternate" type="text/html" title="Sealed: Custom Wax Seal NFC Tags" /><published>2024-03-24T00:00:00+00:00</published><updated>2024-03-24T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2024/03/24/sealed</id><content type="html" xml:base="https://blog.vinaybhaip.com/2024/03/24/sealed"><![CDATA[<p><strong>tl;dr:</strong> I designed custom wax seals and embedded NFC tags underneath them. When you tap your phone to the seal, it pulls up a custom website that hosts pictures and videos from my time abroad (securely!).</p>

<p><img src="/assets/images/sealed/three_letters_sealed.png" alt="Seals on Letters" />
<em>Wax sealed envelopes ready to be shipped out!</em></p>

<p>There’s something magical about receiving a card; it’s a physical and eternal representation of the time and effort someone spent on you. When I left the US last year to complete my Masters in Math at Oxford, a lot of friends would say “don’t forget to send us a postcard!” I wanted to live up to that promise – with my own twist on it.</p>

<p>I was walking with a friend through the city and I found a stationery store that was selling wax seal kits. This was exactly what I needed: an excuse to avoid writing my dissertation. I fell in love with the idea, but I didn’t like how I would just buy a generic “V” stamp that anybody else in the world could have. I wanted to make it special; after a conversation with another friend, I embarked on a new side project – <em>Sealed: Custom Wax Seal NFC Tags</em>.</p>

<h3 id="part-1-designing-the-seal">Part 1: Designing the Seal</h3>

<p>Not only were the wax seal kits in the store generic, they were also a bit expensive (&gt;$30!). I found a shop on Etsy that would make and ship my own custom seal to me for around $10, an absolute steal.</p>

<p>For my custom seal, I already had an existing logo from my website, but I wanted to add some flair. After tinkering, I settled on this design:</p>

<p><img src="/assets/images/sealed/seal_logo.png" alt="Seal Logo" />
<em>The logo I designed and used.</em></p>

<p>The background has three lions from my college’s (<a href="https://en.wikipedia.org/wiki/Oriel_College,_Oxford">Oriel College, Oxford</a>) crest. This is where the lore started getting better – what if whenever I sent letters, the wax seal would embed information about the event/where it’s from? So if I send a wax stamp while I’m in NYC, the stamp would have skyscrapers in the background instead. This way, it becomes a souvenir that people can collect. There’s another easter egg in this logo that I won’t put here, but reach out to me if you’re curious!</p>

<p>To make the wax seals pop, I bought metallic sharpies and golden mica dust. The mica dust ended up more in my lungs than on the seals, but the sharpies worked great. I put it all together and did some trial runs, and it looked amazing:</p>

<p><img src="/assets/images/sealed/envelope.png" alt="Single Seal on Envelope" />
<em>This seal came out picture-perfect! It took several tries to find the right balance for how much wax to melt.</em></p>

<p>The design I originally sent in for the stamp had an issue with the masking, which drives me crazy to look at now, but it’s one of those things you don’t notice until it’s pointed out to you (no, I won’t point it out). We’ll just say it adds ✨character✨.</p>

<h3 id="part-2-integrating-nfc-tags">Part 2: Integrating NFC Tags</h3>

<p>My friends and I have always wanted to use NFC tags<sup id="fnref:nfc" role="doc-noteref"><a href="#fn:nfc" class="footnote" rel="footnote">1</a></sup> for an interactive photo album. Sadly, this is another side project that has yet to come to fruition, so I was worried that by ordering more tags, they would just collect dust in my closet again. Luckily, this wasn’t the case.</p>

<p>The big question: does melting wax over NFC tags melt them/impede functionality? Thankfully, no. Though, I think I bought poor quality tags because they were a little finnicky and take a few taps with your phone angled the right way for it to trigger.</p>

<p><img src="/assets/images/sealed/blurred_letter.png" alt="Letter with NFC Tag" />
<em>The inside of a card. Each letter had two seals; one for the outside of the envelope and one for inside the card, which had the NFC tag. You can see that the wax seal juts out a little bit due to the thickness of the NFC tag.</em></p>

<p>I then linked the NFC tags to a website I made that hosted photos from my time abroad.</p>

<h3 id="part-3-building-a-secure-photo-tiling-website">Part 3: Building a Secure Photo Tiling Website</h3>

<p>Making the website turned out to be less straightforward than I thought it would be. There were a few constraints I had for the project:</p>
<ul>
  <li>Display my pictures as tiles with captions on certain pictures</li>
  <li>Keep the website under my main domain and stick with Github Pages</li>
  <li>Be secure without having my pictures being publicly available online. My pictures aren’t anything sensitive, but in the age of AI where bots scrape the web for training data, having at least some protection would make me feel better.</li>
</ul>

<p>The first bullet point was easy, I found <a href="https://masonry.desandro.com">this package</a> for tiling photos. I put some custom CSS and made it look nice.</p>

<p><img src="/assets/images/sealed/sealed_website.gif" alt="Photo Tiled Website" />
<em>The (blurred) website with custom pictures/videos and captions on certain tiles.</em></p>

<p>The problem was that the second and third bullet points were in contention. Hosting it on Github Pages meant it would be a static website, but then any images would be public (images would be sent to the user with a request to the page or the url to the image would be in the source code).</p>

<p>One option was to password protect my webpage, though I would have to make my website dynamic and have a server. Maybe I’m stubborn, but I don’t want to do this. It adds to the maintainability of the website, and I like how everything is already hosted on Github Pages.</p>

<p>Another option would be to use a custom Google Photos album or something alike. This still isn’t hosted on my website, but at least there’s not much to maintain. I don’t like this option either though; I had a particular vision for how the images and captions would be displayed, and if I wanted to customize it more in the future or put something else linked on the NFC tags, it’s more straightforward if I have the architecture on my own site.</p>

<p>After some research, I came across <a href="https://github.com/robinmoisson/staticrypt">Staticrypt</a>. This was so interesting – it uses <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES-256 encryption</a> for a static website; the password you enter is used as a key to decrypt an encrypted webpage that was stored on the site.<sup id="fnref:crypto" role="doc-noteref"><a href="#fn:crypto" class="footnote" rel="footnote">2</a></sup> Pretty cool!</p>

<p>The last issue was with images. I couldn’t host the images on Github Pages, because then they’d be served on the webpage and could be scraped – even if I used Staticrypt. Instead, I put the pictures in an S3 bucket and used the links, which would also be a part of the encrypted source code. This way, no images would be sent to the user until the website was decrypted and reloaded.</p>

<p>There were some other details like compressing the images and videos so the website didn’t have horrible lag. I also modified the Staticrypt code a bit to suit my needs (I won’t dive into that here, because, well, that kind-of defeats the purpose of security measures, right?). The end result is a decently secure website that people can access with a specific password – it’s not the state-of-the-art, but gets the job done.</p>

<p><br /></p>

<p>I then wrote a bunch of letters on Oxford-themed greeting cards and trusted Royal Mail from there! I’m pretty happy with how this project turned out, and hopefully this is the start of a tradition of mailing letters 😁.</p>

<hr />
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:nfc" role="doc-endnote">
      <p>In case you’re unfamiliar with them, they’re cheap pieces of electronics in plastic that embed data that your phone can read from nearby. <a href="#fnref:nfc" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:crypto" role="doc-endnote">
      <p>I took a cryptography class in high school and had to implement AES-256; while I’m pretty sure my code was neither correct nor secure back then, it’s cool how it’s become a full circle moment. <a href="#fnref:crypto" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[A side quest to make immersive wax seals.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.vinaybhaip.com/assets/images/sealed/three_letters_sealed.png" /><media:content medium="image" url="https://blog.vinaybhaip.com/assets/images/sealed/three_letters_sealed.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Dissonant Trails</title><link href="https://blog.vinaybhaip.com/2022/03/12/dissonant-trails" rel="alternate" type="text/html" title="Dissonant Trails" /><published>2022-03-12T00:00:00+00:00</published><updated>2022-03-12T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2022/03/12/dissonant-trails</id><content type="html" xml:base="https://blog.vinaybhaip.com/2022/03/12/dissonant-trails"><![CDATA[<p><img gif="/assets/images/dissonant-trails/three-jump.gif" static="/assets/images/dissonant-trails/three-jump.jpeg" class="gif" width="50%" /></p>

<p><em>An example of a Dissonant Trail. Hover over/tap the image to see how it was constructed. <b>Keep in mind these GIFs are large (~20 MB) if you are on data.</b></em></p>

<h2 id="background">Background</h2>

<p>I’m currently taking a class on Stochastic Processes and thought it’d be cool to make some generative art using what I learned. I have some bigger ideas involving stochastic processes in the works, but in the meanwhile, I thought I’d share some art that I made with it.</p>

<h2 id="making-dissonant-trails">Making Dissonant Trails</h2>

<p>I considered an $n$ discrete state system and wanted to visualize the transitions between the states. Instead of showing the probabilities of the transitions between states, I put particles at the states and simulated multiple timesteps to determine each particle’s path. Visualizing the path gives the “trail” part of the visual. The “dissonant” part comes from the noise of particles colliding with each other.</p>

<p>To make this abstract idea concrete, I used <a href="https://d3js.org">D3</a> to simulate the particles, and used <a href="https://github.com/d3/d3-force">D3-Force</a> to make the particles move between states.</p>

<p>I considered one particle and visualized its path in a system and I got this:</p>

<p><img src="/assets/images/dissonant-trails/process-one.png" width="50%" /></p>

<p>At first, it looks like a bunch of scribbling, but there’s actually some interesting things going on. For example, at the top, the path stayed in the same state but sort-of moved around, probably colliding with other particles. Next, I considered multiple particles’ paths in a system:</p>

<p><img src="/assets/images/dissonant-trails/process-many.png" width="50%" />
<em>Looks like a box of crayons!</em></p>

<p>If you’re interested in how each path is constructed, here’s a video showing the particles over time:</p>

<video width="100%" controls="">
  <source src="/assets/images/dissonant-trails/process.mp4" type="video/mp4" />
  Video isn't working :(
</video>

<p>At this point, I thought it was pretty cool and started messing with some of the stylistic elements, like the stroke properties and background:</p>

<p><img src="/assets/images/dissonant-trails/process-no-glow.jpeg" width="50%" /></p>

<p><img src="/assets/images/dissonant-trails/process-faded.jpeg" width="50%" /></p>

<p>I wanted to try visualizing even more paths and particles, but the rendering on the page was becoming super slow, so I had to cap it off at a point.</p>

<p>Ultimately, the uniqueness of a generative piece comes from a) the number of states b) the transition matrix c) sampling from the transition matrix and d) moving the states location over time.</p>

<h2 id="examples">Examples</h2>

<!-- <img src="/assets/images/dissonant-trails/left-right.jpeg" width="50%"/>

<img src="/assets/images/dissonant-trails/two-jump.jpeg" width="50%"/>

<img src="/assets/images/dissonant-trails/three-jump.jpeg" width="50%"/>

<img src="/assets/images/dissonant-trails/5-gon.jpeg" width="50%"/>

<img src="/assets/images/dissonant-trails/arc.png" width="50%"/>

<img src="/assets/images/dissonant-trails/circle-20.jpeg" width="50%"/>
 -->

<p><img src="/assets/images/dissonant-trails/poster.png" alt="Poster" />
<em>A graphic with some of the dissonant trails</em></p>

<p>Check out the full code to make your own Dissonant Trails <a href="https://github.com/vbhaip/dissonant-trails">here</a>.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Generative art using paths of particles.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.vinaybhaip.com/assets/images/dissonant-trails/three-jump.jpeg" /><media:content medium="image" url="https://blog.vinaybhaip.com/assets/images/dissonant-trails/three-jump.jpeg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Perlin Planets</title><link href="https://blog.vinaybhaip.com/2021/01/26/perlin-planets" rel="alternate" type="text/html" title="Perlin Planets" /><published>2021-01-26T00:00:00+00:00</published><updated>2021-01-26T00:00:00+00:00</updated><id>https://blog.vinaybhaip.com/2021/01/26/perlin-planets</id><content type="html" xml:base="https://blog.vinaybhaip.com/2021/01/26/perlin-planets"><![CDATA[<p><img gif="/assets/images/perlin-planets/cyan.gif" static="/assets/images/perlin-planets/cyan.jpg" class="gif" width="50%" />
<em>An example of a Perlin planet. Hover over/tap the image to see it in action. <b>Keep in mind these GIFs are large if you are on data.</b></em></p>

<h2 id="background">Background</h2>

<p>I came across <a href="https://avinayak.github.io/art/2021/01/09/noise-planets.html">this cool blog post</a> from <a href="https://github.com/avinayak">Atul Vinayak</a> on what they call “noise planets.” I recommend checking out the post, but basically they created generative art to replicate art from <a href="https://twitter.com/tylerxhobbs">Tyler Hobbs</a>. The way to generate this is to make flow fields using <a href="https://en.wikipedia.org/wiki/Perlin_noise">Perlin noise</a>, which I found incredibly fascinating. The post was pretty popular on <a href="https://news.ycombinator.com/item?id=25712767">Hacker News</a>, but I noticed one of the comments said it was more like noise circles, rather than noise spheres. I decided to fix that.</p>

<h2 id="making-perlin-planets">Making Perlin Planets</h2>

<p>The first step was replicating the work from the aforementioned blog post. I won’t go into that here because the blog post already does a great job. The main changes I made were making the edges of the circle have less opacity and reducing the stroke width at the edges to give the illusion of depth.</p>

<p><img gif="/assets/images/perlin-planets/flat-planet.gif" static="/assets/images/perlin-planets/flat-planet.png" class="gif" width="50%" />
<em>My first attempt at a Perlin planet. Remember to click it to see the GIF and that it may take a few seconds to load.</em></p>

<p>Looks cool! It was a bit more like a planet, but it wasn’t great. If I really wanted to make it planet-esque, I’d have to take the Perlin noise and put it on an actual sphere.</p>

<p>To do this, I intuitively generated random points on the sphere shell by sampling $\phi \in [0, \pi)$ and $\theta \in [0, 2\pi)$ (<strong>foreshadow: my intuition was wrong</strong>). Then, I used 2D Perlin noise passing in the current location of the point defined by $\phi$ and $\theta$ to determine the next location.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">n</span> <span class="o">=</span> <span class="nx">noise</span><span class="p">(</span><span class="nx">phi</span><span class="p">,</span> <span class="nx">theta</span><span class="p">)</span>
<span class="nx">phi</span> <span class="o">+=</span> <span class="nx">sin</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="nx">PI</span><span class="o">*</span><span class="nx">n</span><span class="p">);</span>
<span class="nx">theta</span> <span class="o">+=</span> <span class="nx">cos</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="nx">PI</span><span class="o">*</span><span class="nx">n</span><span class="p">);</span>
</code></pre></div></div>

<p>The last thing to do was to rotate the $\phi$ and $\theta$ of each point to give the feeling of the sphere rotating on an axis.</p>

<p><img gif="/assets/images/perlin-planets/phi-theta-bug.gif" static="/assets/images/perlin-planets/phi-theta-bug.png" class="gif" width="50%" />
<em>This was the result when rotating $\phi$ throughout time.</em></p>

<p>Weird. There’s two issues: 1. everything looks like it’s getting sucked into the center and thrown out on repeat and 2. if you look carefully, the boundary at $\theta = 2\pi$ (or $0$) isn’t continuous.</p>

<p>The first issue is due to a conceptual flaw; if you imagine a ring of points around a sphere’s vertical axis, they all have the same $\phi$. What this means is that incrementing the $\phi$ value is going to make all the points on that ring go up and down the sphere together, which when seen through the top, looks like it’s getting sucked into a vortex.</p>

<p>To deal with this issue, I decided to shift to standard cartesian coordinates. To rotate the coordinates around an axis, I used <a href="https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula">Rodrigues’ rotation formula</a>.</p>

<p>The second issue has partially to do with the continuity of the flow fields. The idea is that <code class="language-plaintext highlighter-rouge">noise(0)</code> and <code class="language-plaintext highlighter-rouge">noise(2$\pi$)</code> won’t have the same value. This is fixed by saying if $\theta &gt; \pi$, then $\theta = 2\pi - \theta$, for the purposes of drawing the flow fields. This means that it’ll be continuous everywhere.</p>

<p><img gif="/assets/images/perlin-planets/rotating-uneven-distrib.gif" static="/assets/images/perlin-planets/rotating-uneven-distrib.png" class="gif" width="50%" />
<em>Perlin planet with the issues above fixed.</em></p>

<p>A lot better! There’s still one more thing that’s fishy. The points at the poles are much more dense than that of the equator. After a bit of <a href="https://mathworld.wolfram.com/SpherePointPicking.html">research</a>, it turns out that my sampling method of $\phi$ and $\theta$ was wrong! If we think about it, let’s say we have the circle where $\phi = \frac{\pi}{100}$ vs $\phi = \frac{\pi}{2}$. We’d then be sampling $\theta$ from each of these two circles to gives us some points, but we’d have the same number of points on each of the two circles, when the circle at $\phi = \frac{\pi}{100}$ obviously should have less points since it’s a smaller circle. The fix for this is to sample $x, y,$ and $z$ from a Gaussian distribution and normalize them.</p>

<p>The last issue was how long the rendering time for these drawings took. To generate 100 frames, it took roughly 5 minutes. I created a Python script using Selenium to automate the process, adding a query string to specify things like the colors and axis of rotation. To give an even cooler effect, I change the axis of rotation over time as well. The result were some pretty cool Perlin planets.</p>

<h2 id="examples">Examples</h2>

<p><img gif="/assets/images/perlin-planets/pastel-pink.gif" static="/assets/images/perlin-planets/pastel-pink.jpg" class="gif" width="50%" /></p>

<p><img gif="/assets/images/perlin-planets/pastel.gif" static="/assets/images/perlin-planets/pastel.jpg" class="gif" width="50%" /></p>

<p><img gif="/assets/images/perlin-planets/pink-orange.gif" static="/assets/images/perlin-planets/pink-orange.jpg" class="gif" width="50%" /></p>

<p><img src="/assets/images/perlin-planets/poster.png" alt="Poster" />
<em>A graphic with some of the planets</em></p>

<p>Check out the full code to make your own Perlin planets and to see more examples <a href="https://github.com/vbhaip/perlin-planets">here</a>.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Generative art as noise on rotating planets.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.vinaybhaip.com/assets/images/perlin-planets/cyan.jpg" /><media:content medium="image" url="https://blog.vinaybhaip.com/assets/images/perlin-planets/cyan.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>