Solving Eigenvalue Problems Via the Shooting Method
In this video, we look at eigenvalue problems resulting from certain differential equations constrained by boundary values as well as constraints needed to make the results physical. This video is in response to questions on the shooting method so that is the technique we will use in this video. I will not go into detail on the shooting method as we have covered it previously. See the link below for a refresher. In this video, I will just show how to adapt the method for eigenvalue problems.
Shooting Method: https://youtu.be/3hf2v39HJQE
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/Eigenvalue%20Problem.ipynb
Tip Jar: https://paypal.me/kpmooney
18
views
Impromptu Video: Calculating the Implied Volatility of a Put Using Excel
This is a quick, impromptu video addressing a question on which fields to modify in our old spreadsheet to calculate the implied volatility of a put option rather than a call. Please see the videos below for an explanation of the math involved.
Original video calculating volatility with Excel: https://youtu.be/ljlqGWz1xDY
Video series on Newton’s Method: https://youtu.be/Q6COHive9CY
Calculating the Implied Volatility of a Option with Python: https://youtu.be/Jpy3iCsijIU
Calculating the IV of an Option with Excel: https://youtu.be/ljlqGWz1xDY
Tip Jar: https://paypal.me/kpmooney
13
views
Calculating the Inverse of a Matrix by LU Decomposition
This is a quick video answering a viewer’s question on using LU decomposition to find the inverse of a matrix.
Original video on LU decomposition here: https://youtu.be/5eBmb8ir-uA
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/matrix_decomposition/Inverse%20via%20LU%20Decomposition.ipynb
Tip Jar: https://paypal.me/kpmooney
15
views
Cholesky Decomposition and Its Applications in Python
In this video, we go over Cholesky decomposition of symmetric matrices. In terms of solving systems of linear equations, it is very similar to LU decomposition. I will show how to do the decomposition in and how to solve a system of linear equations using Numpy’s and Scipy’s built-in functions. Then we will explore how we can use this to generate correlated random variables. This has applications in finance where one might wish to do a Monte Carlo simulation on two or more correlated stocks.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/matrix_decomposition/Cholesky%20Decomposition.ipynb
Tip Jar: https://patpal.me/kpmooney
94
views
Pairs Trading: The Ornstein-Uhlenbeck Process and Pairs Ration Determination
In this video, we continue going over some of the material in the book Optimal Mean Reversion Trading: Mathematical Analysis And Practical Applications by Tim Siu-tang Leung, Xin Li. Continuing with what we have done previously, we will use maximum likelihood estimation to estimate the Ornstein-Uhlenbeck parameters. This will be in the context of pairs trading, so we will extend what we’ve done to estimate the optimal share ratio that comprises the pair.
Previous videos in this series:
What is a pairs trade: https://youtu.be/vHzlZECzyPE
Maximum Likelihood Estimation with Ornstein-Uhlenbeck (part 1): https://youtu.be/GdqVY1kZ4XI
Maximum Likelihood Estimation with Ornstein-Uhlenbeck (part 2)
: https://youtu.be/3906CWKhLqQ
Tip Jar: https://paypal.me/kpmooney
25
views
Calculating the Probability of a Stock Reaching a Given Price in a Specified Time Window in Excel
In a previous video, I showed how to calculate the probability a stock will touch a given value in a specified amount of time. We did this in Python using Monte Carlo techniques. A viewer asked if I could show how to do the same type of calculation in Excel. While Excel isn’t the ideal tool for this, it can be done, and I’ll show how it can be done.
Original Video: https://youtu.be/PRLnusDWSW0
Github: https://github.com/kpmooney/numerical_methods_youtube/tree/master/probability_of_a_touch
Tip Jar: https://paypal.me/kpmooney
18
views
Calculating Historical Stock Volatility with Python and Excel
A viewer asked if I could do a video on how to calculate historical volatility of a stock in Excel. In this video, I will explain how to do so using Python’s pandas package as well as Numpy. I will, of course, show the same thing in Excel.
Github Jupyter Notebook: https://github.com/kpmooney/numerical_methods_youtube/blob/master/market_analysis/Historical%20Volatility.ipynb
Github Excel Sheet: https://github.com/kpmooney/numerical_methods_youtube/blob/master/market_analysis/historical%20Volatility.xlsx
Tip Jar: https://paypal.me/kpmooney
13
views
Maximum Likelihood Estimation - the Ornstein-Uhlenbeck Process(part 2)
In part one, we looked at the method of maximum likelihood estimation in the context of the normal distribution. Keeping with the theme of this channel, we also showed how to calculate these parameters numerically if one cannot derive an analytical solution. In the video, we look at using maximum likelihood estimation for extracting the parameters where our random variable follows an Ornstein-Uhlenbeck process. We will look at some simulated data and extract the parameters numerically. Since these videos will eventually lead to parameter analysis for mean-reverting pairs trades, we will also compare our answers with the results given analytically in the book, Optimal Mean Reverting Trading mentioned in the description of part one.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/ornstein_uhlenbeck/Max%20Likelihood.ipynb
Tip Jar: https://paypal.me/kpmooney
2
views
Maximum Likelihood Estimation (Part 1)
This is the first real video in the series on mean-reverting assets and pairs trading. A viewer requested that I look over and discuss a couple chapters in a book on the aforementioned mean-reverting assets. The first chapter deals with estimating statistical parameters via maximum likelihood estimation. We will discuss what that means and take a look at the simple case of the normal distribution. While this is a simple problem that can be solved analytically, I will also show how it can be solved numerically using Scipy’s optimization tools.
In part two, we will look at the Ornstein-Uhlenbeck process used by the authors and show how we can use the same techniques to estimate those parameters.
The book noted above: Optimal Mean Reverting Trading Mathematical Analysis and Practical Applications by Tim Leung and Xin Li.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/ornstein_uhlenbeck/Max%20Likelihood.ipynb
Tip Jar: https://paypal.me/kpmooney
2
views
What is a Pairs Trade
As a prelude/supplement to videos on mean-reverting trading, I want to briefly discuss the topic of pairs trades. So this video will be a bit different in that I won’t be doing any computational mathematics, and only using the computer to do some plots. This video will simply define pairs trades and briefly talk about why one might want to do one.
Tip Jar: https://paypal.me/kpmooney
2
views
Solving Boundary Value problems via Orthogonal Collocation
We continue with boundary value problems this time using a method often referred to as orthogonal collocation. In previous videos, we approximated a differential equation with a system of coupled algebraic equations. This system was often fairly large, say 100 or more coupled equations. This method allows (in some cases) to represent the differential equation by a handful of algebraic equations (though the matrices involved are not sparse). This potentially allows us to solve complicated systems much faster.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/Orthogonal%20Collocation.ipynb
Tip Jar: https://paypal.me/kpmooney
4
views
Surfing in Mynich
People surfing on the standing wave in the English Garden in Munich, Germany.
6
views
Forest of Lights at Descanso Gardens
From the winter enchanted forest light show at Descanso Gardens near Pasadena California.
4
views
Viewer Questions: Banded Solver and Forward Differencing for Solving Linear Boundary Value Problems
NOTE: DURING THE VIDEO i MENTION NOT KNOWING WHY THE FINITE DIFFERENCE USING A MODIFIED FORWARD DIFFERENCING SCHEME FAILED. THIS WAS A CASE OF BEING A LITTLE TOO CLOSE TO THE PROBLEM AND WHEN UPDATING THE NOTEBOOK FOR PUBLICATION A WEEK LATER, IT BECAME OBVIOUS. RATHER THAN RERECORDING EVERING, i JUST MADE THE NOTEBOOK A LITTLE MORE DETAILED AND EXPLAIN WHAT IS GOING ON. SO, PLEASE SEE THE NOTEBOOK FOR A FULL EXPLAINATION.
In answer to two questions, we will look again at solving linear boundary value problems using a finite difference approach. We will first do this using the solve_banded function in Scipy to solve the banded matrix equations that results from discretizing the differential equation. Second, we will look at other differencing schemes. In this case a viewer asked specifically about the forward difference approximation. There is more information in the github notebook about the forward and backward differencing methods.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/Banded%20Solver%20and%20Forward%20Difference.ipynb
Tip Jar: https://paypal.me/kpmooney
10
views
Nonlinear Differential Equations Using Finite Differences: Can we Use Sparse Matrices?
NOTE: WHEN RECORDING THIS, i ACCIDENTALLY FORGOT TO USE THE SPARSE IDENTITY MATRIX IN MATLAB. THE GITHUB CODE HAS BEEN UPDATED AND IS CORRECT. THE 10000-DIMENSIONAL SYSTEM IS NOW SOLVED IN 0.9 SECONDS INSTEAD OF TWO MINUTES!
In answer to a question, we look at using sparse matrices in the solution of boundary value problems. For nonlinear problems, things become more complicated, but we can still use fsolve to solve the underlying system of equations. The issue with Python is the solver cannot handle sparse Jacobian matrices so this limits the utility of this method to small problems. For solvers that can handle sparse Jaboians such as MATLAB’s, we can still get good performance despite having to use a nonlinear solver.
Wikipedia Article on the Jacobian Matrix: https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant
Github Python Notebook: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/Nonlinear%20BVP.ipynb
Github MATLAB Code: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/Nonlinear.m
Tip Jar: https://paypal.me/kpmooney
12
views
Option Greeks and Taylor Series
In this video we look at how the Greeks can be used to approximate the Black-Scholes model giving us a way to estimate risk and P&L without using the full model. We will also consider higher order corrections leading to Taylor series representations. Finally we will consider cases where the Greeks and Taylor series provide poor approximations.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/option_greeks/Taylor%20Series%20and%20Option%20Greeks.ipynb
Earlier Greeks video: https://youtu.be/pa2zNZ3FHH8
Tip Jar: https://paypal.me/kpmoooney
13
views
Channel Update, Answer to Questions on Theta Calculation and Newton's Method in VBA
A brief update discussing upcoming topics and quick answers to two questions. Time stamps for the questions are below.
Discrepancies in theta calculated here vs. number given by platform: https://youtu.be/sfhI-zwsIc0?t=229
Newton’s method for calculating implied volatility using VBA: https://youtu.be/sfhI-zwsIc0?t=732
Upcoming topics in no particular order:
* Eigenvalue problems and the shooting method
* Nonlinear boundary value problems via finite differences
* Boundary value problems via orthogonal collocation
* Time series and autocorrelation
* Mean reversion
* Ornstein-Uhlenbeck model
* Pricing of barrier options
Note on IV in VBA: I was unable to upload the Excel file with the macro so you’ll have to download the text file with the code and paste it in.
Excel File on Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/root_finding/implied_volatility/IV_VBA.xlsm
Text File Containing Macro on Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/root_finding/implied_volatility/VBA_code.txt
Tip Jar: https://paypal.me/kpmooney
1
view
More on Boundary Value Problems Using the Shooting Method
In answer to a question, we look at applying the shooting method to a boundary value problem where we know the function value at one boundary, and its derivative at the second boundary. \
First Video on the Shooting Method: https://youtu.be/3hf2v39HJQE
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/Shooting%20Method%202.ipynb
Tip jar: https//paypal.me/kpmooney
6
views
Calculating Implied Volatility from an Option's Price Using the Binomial Model
I wanted to do a quick video following up with the binomial option model we looked at in an earlier video. I’ll quickly show how we can use Scipy’s function fsolve to solve for the IV. This is a simple extension on concepts we’ve already discussed using Black-Scholes as the p[ricing model.
Binomial Model: https://youtu.be/d7wa16RNRCI
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/binomial_model/Binomial%20Model.ipynb
Tip Jar: https://paypal.me/kpmooney
60
views
Implementing the Binomial Option Pricing model in Python
We will implement a simple binomial option model in Python. A binomial model assumes a stock moves discreetly either up by a specified percentage or down by a specified percentage. The “binomial” here refers to the fact there are only two possible values for the stock to take on in any given time step. Options are then priced based on the resulting tree-like structure working back from expiration to the time of interest.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/binomial_model/Binomial%20Model.ipynb
Tip Jar: https://paypal.me/kpmooney
46
views
Singular Value Decomposition, Linear Systems, and the Pseudoinverse
Continuing with the idea of matrix decompositions, we look at the singular value decomposition (SVD) and how it can be used to solve systems of linear equations. We also look at the idea of the pseudoinverse and apply it to overdetermined and underdetermined systems.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/matrix_decomposition/Singular%20Value%20Decomposition.ipynb
Tip Jar: https://paypal.me/kpmooney
64
views
Orthogonal Polynomial Series in Numpy: Playing with Legendre and Chebyshev Series
In this video we explore the convenience classes used to generate series of orthogonal polynomials. We play around with Legendre and Chebyshev polynomials.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/polynomial/Orthogonal%20Polynomials.ipynb
Tip Jar: https://paypal.me/kpmooney
55
views
Creating and Manipulating Polynomials in Numpy
There are many ways to handle polynomials in Numpy. Some of these treat arrays or lists as the polynomial coefficients. Some create objects with built-in functions to perform manipulations or calculations such as finding the roots or calculating the derivative. I will go over the three main way to handle polynomials in Numpy.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/polynomial/Polynomial%20in%20Numpy.ipynb
Tip Jar: https://paypal.me/kpmooney
53
views
Boundary Value Problems via a Finite Difference method
In this video we will return to boundary value problems and solve the same equation we used for the shooting method video, this time via a finite difference method. We will transform the problem from a differential equation into a coupled system of algebraic equations. In this case, since the system is linear, we can make use of our basic linear algebra to get the solution. In the non-linear case, we could run the resulting system through a nonlinear solver like fsolve to get an answer.
Shooting Method: https://youtu.be/3hf2v39HJQE
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/bvp/BVP%20Via%20Finite%20Difference.ipynb
Tip Jar: https://paypal.me/kpmooney
59
views
Polynomial Interpolation
In this video, will will go over the basics of polynomial interpolation. We will use this as a starting point for spline interpolations, and of solving boundary value problems via the orthogonal collocation method. We will touch briefly on the built in commands for generating the polynomial coefficients via Lagrange coefficients.
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/polynomial_interpolation/Polynomial%20Interpolation.ipynb
Tip Jar: https://paypal.me/kpmooney
74
views