Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/SJVersion' into SJVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
pwq committed Nov 30, 2024
2 parents e4c0b22 + 42fc9a2 commit 9b91bfb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 45 deletions.
Binary file added Diagram_overleaf/Errors_vs_l.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Diagram_overleaf/Numerical Stability.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Diagram_overleaf/convergence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:
Expand Down
62 changes: 18 additions & 44 deletions Testing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -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"
]
}
Expand All @@ -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": [
Expand All @@ -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"
}
Expand Down

0 comments on commit 9b91bfb

Please sign in to comment.