When Physics Meets Finance: Using AI to Solve Black-Scholes

Here's how to use Physics-Informed Neural Networks to solve Financial Models, with Python. The post When Physics Meets Finance: Using AI to Solve Black-Scholes appeared first on Towards Data Science.

Apr 18, 2025 - 06:18
 0
When Physics Meets Finance: Using AI to Solve Black-Scholes

DISCLAIMER: This is not financial advice. I’m a PhD in Aerospace Engineering with a strong focus on Machine Learning: I’m not a financial advisor. This article is intended solely to demonstrate the power of Physics-Informed Neural Networks (PINNs) in a financial context.

When I was 16, I fell in love with Physics. The reason was simple yet powerful: I thought Physics was fair.

It never happened that I got an exercise wrong because the speed of light changed overnight, or because suddenly ex could be negative. Every time I read a physics paper and thought, “This doesn’t make sense,” it turned out I was the one not making sense.

So, Physics is always fair, and because of that, it’s always perfect. And Physics displays this perfection and fairness through its set of rules, which are known as differential equations.

The simplest differential equation I know is this one:

Image made by author

Very simple: we start here, x0=0, at time t=0, then we move with a constant speed of 5 m/s. This means that after 1 second, we are 5 meters (or miles, if you like it best) away from the origin; after 2 seconds, we are 10 meters away from the origin; after 43128 seconds… I think you got it.

As we were saying, this is written in stone: perfect, ideal, and unquestionable. Nonetheless, imagine this in real life. Imagine you are out for a walk or driving. Even if you try your best to go at a target speed, you will never be able to keep it constant. Your mind will race in certain parts; maybe you will get distracted, maybe you will stop for red lights, most likely a combination of the above. So maybe the simple differential equation we mentioned earlier is not enough. What we could do is to try and predict your location from the differential equation, but with the help of Artificial Intelligence.

This idea is implemented in Physics Informed Neural Networks (PINN). We will describe them later in detail, but the idea is that we try to match both the data and what we know from the differential equation that describes the phenomenon. This means that we enforce our solution to generally meet what we expect from Physics. I know it sounds like black magic, I promise it will be clearer throughout the post.

Now, the big question:

What does Finance have to do with Physics and Physics Informed Neural Networks?

Well, it turns out that differential equations are not only useful for nerds like me who are interested in the laws of the natural universe, but they can be useful in financial models as well. For example, the Black-Scholes model uses a differential equation to set the price of a call option to have, given certain quite strict assumptions, a risk-free portfolio.

The goal of this very convoluted introduction was twofold:

  • Confuse you just a little, so that you will keep reading                         </div>
                                            <div class= Read More