diff --git a/Diagram_overleaf/Errors_vs_l.png b/Diagram_overleaf/Errors_vs_l.png new file mode 100644 index 0000000..439668d Binary files /dev/null and b/Diagram_overleaf/Errors_vs_l.png differ diff --git a/Diagram_overleaf/Numerical Stability.png b/Diagram_overleaf/Numerical Stability.png new file mode 100644 index 0000000..96aef12 Binary files /dev/null and b/Diagram_overleaf/Numerical Stability.png differ diff --git a/Diagram_overleaf/convergence.png b/Diagram_overleaf/convergence.png new file mode 100644 index 0000000..8cdacee Binary files /dev/null and b/Diagram_overleaf/convergence.png differ diff --git a/README.md b/README.md index 467d5f3..508b3bd 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ The complete algorithm involves the following steps: - These values are used to determine the function $f(\tau, B)$, which is central to the fixed-point iteration scheme. 7. **Compute the Derivative of $f(\tau_i, B)$**: - - We approximate the derivative $f'(\tau, B)$ using finite differences. + - We use the closed form solution for Derivative of f - This derivative is critical for the Jacobi-Newton update step. 8. **Update Boundary Values Using Jacobi-Newton Scheme**: diff --git a/Testing.ipynb b/Testing.ipynb index af37eb4..a7d3d58 100644 --- a/Testing.ipynb +++ b/Testing.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 8, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -12,30 +12,32 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ - "test1 = AmericanOptionPricing(100, 0.05, 0.05, 0.25, 1, 25, 4, 9, 51, option_type=OptionType.Put,eta=0.8)" + "test1 = AmericanOptionPricing(100, 0.05, 0.05, 0.25, 1, 25, 5, 12, 61, option_type=OptionType.Put,eta=0.8)" ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Starting iteration 1/4\n", - "Iteration 1/4 completed.\n", - "Starting iteration 2/4\n", - "Iteration 2/4 completed.\n", - "Starting iteration 3/4\n", - "Iteration 3/4 completed.\n", - "Starting iteration 4/4\n", - "Iteration 4/4 completed.\n", + "Starting iteration 1/5\n", + "Iteration 1/5 completed.\n", + "Starting iteration 2/5\n", + "Iteration 2/5 completed.\n", + "Starting iteration 3/5\n", + "Iteration 3/5 completed.\n", + "Starting iteration 4/5\n", + "Iteration 4/5 completed.\n", + "Starting iteration 5/5\n", + "Iteration 5/5 completed.\n", "Jacobi-Newton iterations completed.\n" ] } @@ -47,35 +49,7 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ 61.24225892, 61.27712165, 61.38204477, 61.55803 ,\n", - " 61.80673573, 62.13045962, 62.53211128, 63.01517446,\n", - " 63.58365337, 64.24200295, 64.995034 , 65.84779433,\n", - " 66.80541202, 67.87290423, 69.05493176, 70.35550743,\n", - " 71.77763053, 73.32286494, 74.99082224, 76.77858653,\n", - " 78.68002539, 80.68506055, 82.77881187, 84.940758 ,\n", - " 87.14375634, 89.35320157, 91.52597224, 93.60973108,\n", - " 95.54162409, 97.24761131, 98.63915229, 99.60889207,\n", - " 100. ])" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "test1.updateded_boundary" - ] - }, - { - "cell_type": "code", - "execution_count": 36, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -84,16 +58,16 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "(9.462492596167081, 0.10696407630320409)" + "(9.462492596167081, 0.10695523378736016)" ] }, - "execution_count": 37, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" }