Lensing and Ellipses: How Gravitational Fields Stretch Background Galaxies
In the previous post, we built a simple gravitational lens raytracer that simulates how…
A Simple Gravitational Lens Raytracer from Scratch
Gravitational lensing is one of the most beautiful predictions of general relativity.When a massive…
The Visible Shape of Random Galaxies: What You Get When You Project a 3D Disk
When we look at galaxies through a telescope, we see them as ellipses. But…
How to Sample the 3D Universe You See in an Image
When we look at an astronomical image, we see a 2D projection of a…
The Odds of Outshining: When One Coin Beats Another
Imagine you’re comparing two trading strategies. One has made a handful of successful trades…
Yield Curve Interpolation with Gaussian Processes: A Probabilistic Perspective
Here we present a yield curve interpolation method, one that’s based on conditioning a…
Building Correlation Matrices with Controlled Eigenvalues: A Simple Algorithm
In some cases, we need to construct a correlation matrix with a predefined set…
Faster Monte Carlo Exotic Option Pricing with Low Discrepancy Sequences
In this post, we discuss the usefulness of low-discrepancy sequences (LDS) in finance, particularly…
Finding the Nearest Valid Correlation Matrix with Higham’s Algorithm
Introduction In quantitative finance, correlation matrices are essential for portfolio optimization, risk management, and asset…
Optimal Labeling in Trading: Bridging the Gap Between Supervised and Reinforcement Learning
When building trading strategies, a crucial decision is how to translate market information into trading…
Efficient Rolling Median with the Two-Heaps Algorithm. O(log n)
Calculating the median of data points within a moving window is a common task…
Fast Rolling Regression: An O(1) Sliding Window Implementation
In finance and signal processing, detecting trends or smoothing noisy data streams efficiently is…
Understanding the Uncertainty of Correlation Estimates
Correlation is everywhere in finance. It’s the backbone of portfolio optimization, risk management, and…
Can we measure president Bush’s heart rate when he was told about the 9/11 attack?
This is a fun project me and my son did over the weekend. I’ve always…
Extracting Interest Rate Bounds from Option Prices
In this post we describe a nice algorithm for computing implied interest rates upper-…
Recovering Accurate Implied Dividend and Interest Rate Term-Structures from Option Prices
In this post we discuss the algorithms we use to accurately recover implied dividend…
Validating Trading Backtests with Surrogate Time-Series
Back-testing trading strategies is a dangerous business because there is a high risk you will…
Parallel Processing of Tasks with Python’s Multiprocessing lib
The Python code snippet below uses the multiprocessing library to processes a list of tasks…
Parameter Grid-searching with Python’s itertools
Python’s Itertools offers a great solution when you want to do a grid-search for optimal…
Gaussian Mixture Approximation for the Laplace Distribution
The Laplacian distribution is an interesting alternative building-block compared to the Gaussian distribution because…