Posts

Showing posts from September, 2019

contex - obtaining the context in which words appear

Image
As of recent I have been studying the standard threading library and thinking of things that I can "multi-thread", this seemed to fit the bill. The idea here is to create a piece of software that can look at a collection of words and then print the context in which they appear in a text, under certain constraints. These collection of words are given as a set of pairs ${W,L}$, each member of this set we will call a query. $W$ being the word of interest and $L$ being the number of words after the word $W$ we want to look at. We also specify $k$ which is the number of words that we want to look at before and after a query. The constraints We want $k$ words to the left of the query word $W$ and $k + L$ words to the right of $W$. We will refer to this sub-collection of words as a window .  We want the L words after W and W itself to be highlighted. If we encounter a full stop then we truncate the window to respect this. If we have overlapping windows then we join the queri...

Numerical Solution of the Black Scholes equation for European Options

Under some assumptions, the Black-Scholes equation is satisfied by any derivative security whose price depends only on the current value of the stock price $S$ and time $t$. These assumptions and the derivation of the Black-Scholes equation can be found with ease, either online or by referring to a great reference such as  The Mathematics of Financial Derivatives  [1]. In this article we show that the Black-Scholes equation for European call options (more generally derivative securities) can be transformed into the heat equation, which makes a numerical solution very simple. In a later blog post we will see how to numerically solve problems in the Black-Scholes framework when American options are considered. If fact, the purpose of this post is to get used of the basics before moving on to some more exotic techniques. Also, it gives me a chance to develop test cases for my attempt at a modern C++ linear solver  SolvAnt . By following [1], we can write the Black-Sc...