More Kinematics problems: Differential Equations and Event Detection using Python (Numpy and Scipy)
We continue with kinematics problems look at solving first and second order differential equations and using the solver’s built in event detection capabilities. This event detection is useful in real-world problems.
This part two dealing with transforming a system of differential equations into a system of algebraic equations. In part one, we had the advantage of dealing with linear equations and solving the problem amounted to finding the inverse of a sparse matrix. In this video we will look at the nonlinear case and adapt our techniques to create a system of equations we can solve using Scipy's fsolve function.
Original Video Using solve_ivp: https://youtu.be/XPT3_L13RFM
Part 1, Linear Case: https://youtu.be/gXBPPY7TzNo
Github: https://github.com/kpmooney/numerical_methods_youtube/tree/master/free_fall
Donate: http://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=gjf6p8Tjv8A
This is a quick video going over the calculation of beta-weighted deltas using Excel. I go through the math in the videos linked below.
Video Detailing the Math of Beta-Weighting: https://youtu.be/PNnOCKHJh8U
Video Going Over the Math of Linear Regression: https://youtu.be/UX_b6ZuZLbI
Github Archive with Excel File: https://github.com/kpmooney/numerical_methods_youtube/tree/master/beta_wieghted_delta
Tip Jar: https://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=R0372ISw79s
I had a deep in-the-money short call on an ETF that was going ex-dividend. Risk of assignment depends on the value of the dividend compared to the extrinsic value left in the option. How do we determine the dividend value of an ETF which does not announce the amount beforehand?
Donate: http://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=vKX371HcbXc
I look at using Newton’s method to solve for the implied volatility of an option. This is done using the Black-Scholes model and a simple Python script.
My mouth and brain were apparently totally out of sync when discussing the numbers in the slide showing the spreadsheet results for the roots of a parabola. This is one of those situations where you should pay attention to what I am thinking rather than what I am saying. In any case, the numbers in the spreadsheet are correct.
Github: https://github.com/kpmooney/numerical_methods_youtube
Original Blog Post: https://kevinpmooney.blogspot.com/2017/07/calculating-implied-volatility-from.html
If you’re interested in trading and looking for a good broker in the US, checkout the possilbity of opening an account with tastyworks: https://start.tastyworks.com/#/login?referralCode=ERQ634TPPJ
Donate: http://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=Jpy3iCsijIU
In previous videos, we have used the Newton’s method to find the roots of various functions. In particular, we inverted the Black-Scholes model to solve for the implied volatility of an option. There are, however, other algorithms that can do this. Here, I present the bisection method. This is a quick video showing the basics of the technique. I don’t go into detail with the volatility as we have done that in several previous videos.
Troubleshooting Newton’s mMethod: https://youtu.be/Q6COHive9CY
Original IV Video: https://youtu.be/Jpy3iCsijIU
Github: https://github.com/kpmooney/numerical_methods_youtube/tree/master/root_finding/bisection
Donate: http://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=T5LnwdV5ETA
The format of this video is a bit different. This is an answer to a question left in the comments so I am going to talk though a notebook I already wrote rather than doing it live on the recording. The question was on accessing mplfinance figures and customizing the plots. A secondary question was how to calculate some trading signals based on various crossovers. As I have said before, I don’t believe in technical analysis so I am presenting this for education purposes only.
Original mplfinance video: https://youtu.be/wiV_nXPdu60
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/market_analysis/mplfinance%20and%20crossover%20signals.ipynb
Donate: https://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=wTtALQysc6M
In answer to a question, I show how we can repurpose our Black-Scholes code to work out option payouts at expiration and generate diagrams for individual options as well as dad's.
Github: https://github.com/kpmooney/numerical_methods_youtube/tree/master/payout
Donate: http://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=6eDaZ-9pjSw
We’ve talked at length about sparse matrices in the previous videos. It turns out that a lot of practical problems produce systems that have a fairly specific shape- a banded matrix. I had assumed Scipy’s sparse solver would reconginze the matrix is banded and use an appropriate algorithm. Evidently, this is not the case. There is, however, a banded solver that can be called specifically. In this video, I briefly go over how to use it and show the performance enhancement over the generic spsolve command.
Part 1: https://youtu.be/v_S7cOL5ZWU
Part 2: https://youtu.be/qo-WzsVnXGE
Part 3: https://youtu.be/qSBqgKVD6EA
Github: https://github.com/kpmooney/numerical_methods_youtube/blob/master/prob_50/More%20on%20Linear%20Systems.ipynb
Donate: https://paypal.me/kpmooney
...
https://www.youtube.com/watch?v=qSBqgKVD6EA