## 2020

• ### Basic D&D Statistics: Dice Rolling with Advantage

In the previous part of this series, we explored how to build the probability distributions for sums of dice rolls. That is sufficient for a great fraction of dice rolling in D&D, but a critical extra case to be considered are rolls made with advantage or disadvantage. In this article, we investigate how to extend our definitions to include die rolls with (dis)advantage.

• ### Basic D&D Statistics: Sums of Dice Rolls

Being reliant on the roll of the dice, actions and outcomes in Dungeons and Dragons are fundamentally tied to probability and statistics. In this article I explore how the sums of dice are related to discrete probability distributions, building up from the case of a single die up to combining any arbitrary set of dice. The quantitative tools we develop will be sufficient to make basic assessments on the (un)likeliness of a given observed outcome.

• ### Prefaulting Memory Mapped Arrays in Julia

One of the key facts about memory maps is that the mapping is performed asynchronously, with the data being loaded on demand as it is used. In some cases, though, we may know that the entire mapped region will be required — and only at the end of some other long-running process — so that there would be an advantage to expending some parallel effort to prefault the entire mapping into memory. In this article I motivate such a use case, and then I explore two separate ways of achieving the prefaulting behavior.

• ### Numerically computing the exponential function with polynomial approximations

Numerically computing any non-trivial function (spanning the trigonometric functions through to special functions like the complex gamma function) is a large field of numerical computing, and one I am interested in expanding my knowledge within. In this article, I describe my recent exploration of how the exponential function can be implemented numerically.

• ### Notes on Calculating the Spherical Harmonics

In this article I review the critical properties of the Spherical Harmonics. In particular, I concentrate on filling in a couple of details regarding numerical computation of the spherical harmonic transformations that I have found to be unstated or less clear than ideal in the literature.

• ### Pre-normalizing Legendre Polynomials

In the previous part we computed Legendre polynomials via a few recurrence relations, but the polynomial values grow rapidly with degree and quickly overflow the range of standard finite floating point numbers. In this posting we explore baking in a normalization factor into the recurrence relation — such as used when the Legendre polynomials are used to calculate the spherical harmonics — that eliminates the overflow.

• ### Calculating Legendre Polynomials

The Associated Legendre Polynomials are implicitly defined as the solution to a second-order differential equation, but most practical uses require an efficient means of explicitly evaluating the functions for any degree, order, and argument. In this article I introduce the implementation used in Legendre.jl which is based on evaluating a series of recurrence relations.

• ### Introduction to Associated Legendre Polynomials

The Associated Legendre Polynomials are an important set of functions in cosmic microwave background (CMB) research. In this first part of an upcoming series, I motivate the need for a new high-performance Julia package — Legendre.jl — which I am writing to recreate a key algorithm in my thesis research.

• ### Image-based Color Palette

Building a color theme around a primary photo can be useful, but picking the “main” colors by hand can be a challenge. Thankfully using a couple of simple analysis techniques, we can extract a color palette automatically.

## 2015

• ### Linear model regression matrices

An extremely common operation on data series is to regress the data with a particular model. Many times, the desired model is a linear combination of known basis functions, and when this is true, the regression of a data series can be encapsulated as a matrix operator. Describing the process as a matrix operation—rather than just using the regression coefficients—isn’t always useful, but it’s description is rarer. Because I needed a regression in this form for my research, I have chosen to write up the solution here.

## 2014

• ### Bellman k-segmentation algorithm

The Bellman $k$-segmentation algorithm generates a segmented constant-line fit to a data series, but in trying to learn and implement this algorithm, I found it difficult to find the segmentation algorithm rather than the [apparently more common] $k$-means algorithm, so in this article I describe and provide code for the $k$-segmentation algorithm.