Optimal Opus

Ramblings on Numerical Programming

Short: Algabraic Data Types Are Not What you Think They Are

I've noticed that some tech content creators have cemented in their heads this idea that Abstract Data Types are just a fancy way of saying sum types, which is an awful shame because ADTs are one of my favorite insights from category theory and can even be an entryway to understanding the big ideas like the Curry–Howard isomorphism . The worst part is, from what I've seen online most creators don't even explain how ADTs got their name in the first place? Which is mind boggling to me, but I...

Read Short
Preview Image

Essay: Array Languages Still Have a Long Way to Go

Referentially transparent type systems that can describe multi-dimensional arrays are still somewhat illusive to even modern programming languages, but researchers are building proof-of-concept compilers that could change the story.

Read Essay
Preview Image

Essay: A multi-dimensional ADT from first principles

Multi-dimensional arrays are an abstract data type used in every single numerical program out there. They can be used to track tracers in 2D or 3D physics simulations, as matrices in linear algebra, as portfolios in financial modelling and in countless other scenarios. Let's dive into the foundations of a possible implementation in C.

Read Essay
Preview Image

Essay: Playing magic tricks with randomness

What do Video games, statistics and data bases all have in common? They all need to use random number generators. But how does a deterministic machine generate randomness? Obviously the answer is it doesn't, but we've gotten pretty damn good at faking it. Let's learn how.

Read Essay

Short: Beware of Taking Float16s From the Cookie Jar

Part of being an industry practitioner requires keeping up-to date on current topics and research. While there's many cool and exciting new frontiers on the horizon the hardware-software interface has been making exceptional strides. A physics paper in particular caught my eye for suggesting the use of 16-bit floating point values in stochastic models. The reasoning is that stochastic models are already random by nature, so they would likely be numerically stable against FP round-off error. I...

Read Short
Preview Image

Essay: A Gentle Introduction to Automatic Differentiation

Differentiation is hard enough when it's in abstract on a math test, but what about when it's living, breathing code? Let's learn how modern numerical computing frameworks like Julia, Pytorch, Tensorflow and JAX all take gradients without ever being told how to do it.

Read Essay
Preview Image

Essay: Unmasking Python's for loop

Today we're going to look at for loops. It's the proverbial peanut butter and jelly sandwich of programming and yet many programming languages don't even have for loops. Let's investigate some alternatives.

Read Essay

Short: The 90's are back in style

Ah the 90's, when Friends was back in its hay-day and Spice Girls CDs were selling like hot cakes. The web was so much better back then with its static, hand-written HTML files. CSS was a nightmare to work with having just been introduced in 1996, and JavaScript was nothing more than a twinkle in Brendan Eich's eye. Or at least that's the story I've been told; I'm just young enough that I don't remember that much of web 1.0 and just old enough that I can pretend I lived through it. Even th...

Read Short

Short: A Better Notation of Derivatives

I'm hoping this is enough of a safe space where I can admit a terrible secret; for most of my undergraduate career I couldn't explain what exactly the 'd' meant in the from differential calculus. One thing I knew for sure is that it's not a real number. I knew this because mathematicians give you this funny look of remorse, anger and depression anytime you mention "multiplying by on both sides of the equation." Answering this question will take us on a little journey, so buckle up. Some His...

Read Short

Short: My Journey to Building a Website

One of the most fun parts of doing a project is sharing the learning experience that comes with it. As a plus I love talking about myself, so I thought I'd dedicate a new post to explain the main bits and pieces to this personal website. Preliminaries Before getting started you're going to need a few things ready. Namely, you'll need: - A domain name (that's the thing people type in the URL box to reach your website) - A server in the backend that's setup to serve sites Strictly speaking...

Read Short

Short: Hello World!

I know the initial commit of this repo is over a month old at this point, but a lot can happen in a month outside hobby-world. Not to mention, that initial commit was written entirely in raw HTML, CSS and JavaScript. Learning a framework like SvelteKit when you're still learning the basics of web development can be... cumbersome, to say the least. I can't count how many times I was pasting the same line of code for the tenth time, noticed how stupid doing that is, googled it and found an infini...

Read Short