Skip to content

Commit

Permalink
rerun experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelmagnu committed Jan 10, 2025
1 parent 58cf0d0 commit dd129a7
Showing 1 changed file with 77 additions and 67 deletions.
144 changes: 77 additions & 67 deletions examples/PyMPDATA_examples/asian_option/analytic_solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,29 @@
"id": "a0685c1dc4186f3f"
},
{
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-09T23:25:35.911076Z",
"start_time": "2025-01-09T23:25:35.836397Z"
}
},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"import sys\n",
"if 'google.colab' in sys.modules:\n",
" !pip --quiet install open-atmos-jupyter-utils\n",
" from open_atmos_jupyter_utils import pip_install_on_colab\n",
" pip_install_on_colab('PyMPDATA-examples')"
],
"id": "fdb84f8c5aaa41aa"
"id": "fdb84f8c5aaa41aa",
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:04:22.860918Z",
"start_time": "2024-12-04T14:04:21.000994Z"
"end_time": "2025-01-09T23:25:45.173651Z",
"start_time": "2025-01-09T23:25:35.911259Z"
}
},
"cell_type": "code",
Expand All @@ -50,13 +55,13 @@
],
"id": "initial_id",
"outputs": [],
"execution_count": 1
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:04:22.876148Z",
"start_time": "2024-12-04T14:04:22.862895Z"
"end_time": "2025-01-09T23:25:45.189682Z",
"start_time": "2025-01-09T23:25:45.173651Z"
}
},
"cell_type": "code",
Expand All @@ -71,7 +76,7 @@
],
"id": "30dc1eab9cd3b037",
"outputs": [],
"execution_count": 2
"execution_count": 3
},
{
"metadata": {},
Expand All @@ -82,8 +87,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:04:22.907551Z",
"start_time": "2024-12-04T14:04:22.877680Z"
"end_time": "2025-01-09T23:25:45.223759Z",
"start_time": "2025-01-09T23:25:45.198441Z"
}
},
"cell_type": "code",
Expand All @@ -96,13 +101,13 @@
],
"id": "92b4e2ba2aa9fe45",
"outputs": [],
"execution_count": 3
"execution_count": 4
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-27T13:15:34.475721Z",
"start_time": "2024-11-27T13:15:34.449092Z"
"end_time": "2025-01-09T23:25:45.240074Z",
"start_time": "2025-01-09T23:25:45.223897Z"
}
},
"cell_type": "code",
Expand All @@ -115,12 +120,12 @@
"24.899334865127113"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 4
"execution_count": 5
},
{
"metadata": {},
Expand All @@ -131,8 +136,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:05:41.266318Z",
"start_time": "2024-12-04T14:05:41.255165Z"
"end_time": "2025-01-09T23:25:45.256961Z",
"start_time": "2025-01-09T23:25:45.240802Z"
}
},
"cell_type": "code",
Expand All @@ -147,7 +152,7 @@
],
"id": "8f79b7d8fc8e11e4",
"outputs": [],
"execution_count": 5
"execution_count": 6
},
{
"metadata": {},
Expand All @@ -158,8 +163,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:05:41.993751Z",
"start_time": "2024-12-04T14:05:41.973550Z"
"end_time": "2025-01-09T23:25:45.273377Z",
"start_time": "2025-01-09T23:25:45.257080Z"
}
},
"cell_type": "code",
Expand All @@ -173,26 +178,26 @@
],
"id": "e65fc43add329912",
"outputs": [],
"execution_count": 6
"execution_count": 7
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-27T13:17:43.938407Z",
"start_time": "2024-11-27T13:17:43.920025Z"
"end_time": "2025-01-09T23:25:45.289720Z",
"start_time": "2025-01-09T23:25:45.273565Z"
}
},
"cell_type": "code",
"source": "assert np.allclose(geometric_mkhize(), geometric_mkhize_general(t=0), rtol=1e-5)",
"id": "35b70b81099eee98",
"outputs": [],
"execution_count": 12
"execution_count": 8
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-27T13:20:01.500885Z",
"start_time": "2024-11-27T13:20:00.940013Z"
"end_time": "2025-01-09T23:25:45.769570Z",
"start_time": "2025-01-09T23:25:45.289972Z"
}
},
"cell_type": "code",
Expand Down Expand Up @@ -224,13 +229,13 @@
"output_type": "display_data"
}
],
"execution_count": 13
"execution_count": 9
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-27T13:20:48.335240Z",
"start_time": "2024-11-27T13:20:47.897102Z"
"end_time": "2025-01-09T23:25:46.105450Z",
"start_time": "2025-01-09T23:25:45.769837Z"
}
},
"cell_type": "code",
Expand Down Expand Up @@ -263,7 +268,7 @@
"output_type": "display_data"
}
],
"execution_count": 14
"execution_count": 10
},
{
"metadata": {},
Expand All @@ -274,8 +279,8 @@
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:04:44.558506Z",
"start_time": "2024-12-04T14:04:44.541026Z"
"end_time": "2025-01-09T23:25:46.122142Z",
"start_time": "2025-01-09T23:25:46.105887Z"
}
},
"cell_type": "code",
Expand All @@ -289,13 +294,13 @@
],
"id": "66e30bebcf590a3",
"outputs": [],
"execution_count": 4
"execution_count": 11
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-24T14:27:16.234361Z",
"start_time": "2024-11-24T14:27:16.215377Z"
"end_time": "2025-01-09T23:25:46.154602Z",
"start_time": "2025-01-09T23:25:46.124808Z"
}
},
"cell_type": "code",
Expand All @@ -308,31 +313,31 @@
"(48.63941024359666, 27.302196350252007)"
]
},
"execution_count": 54,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 54
"execution_count": 12
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-24T14:27:16.956857Z",
"start_time": "2024-11-24T14:27:16.942858Z"
"end_time": "2025-01-09T23:25:46.169929Z",
"start_time": "2025-01-09T23:25:46.154602Z"
}
},
"cell_type": "code",
"source": "assert np.all(european_option() >= geometric_mkhize())",
"id": "7b0faeacd51db9e4",
"outputs": [],
"execution_count": 55
"execution_count": 13
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-24T14:29:58.898717Z",
"start_time": "2024-11-24T14:29:58.652273Z"
"end_time": "2025-01-09T23:25:46.620512Z",
"start_time": "2025-01-09T23:25:46.170046Z"
}
},
"cell_type": "code",
Expand Down Expand Up @@ -372,13 +377,13 @@
"output_type": "display_data"
}
],
"execution_count": 60
"execution_count": 14
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-11-24T14:31:42.747648Z",
"start_time": "2024-11-24T14:31:42.392818Z"
"end_time": "2025-01-09T23:25:47.098778Z",
"start_time": "2025-01-09T23:25:46.620795Z"
}
},
"cell_type": "code",
Expand Down Expand Up @@ -417,13 +422,13 @@
"output_type": "display_data"
}
],
"execution_count": 62
"execution_count": 15
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:09:22.288855Z",
"start_time": "2024-12-04T14:09:21.954775Z"
"end_time": "2025-01-09T23:25:47.673135Z",
"start_time": "2025-01-09T23:25:47.098958Z"
}
},
"cell_type": "code",
Expand Down Expand Up @@ -463,11 +468,11 @@
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Pawel\\AppData\\Local\\Temp\\ipykernel_15556\\1461075552.py:2: RuntimeWarning: divide by zero encountered in log\n",
"C:\\Users\\Pawel\\AppData\\Local\\Temp\\ipykernel_9444\\1461075552.py:2: RuntimeWarning: divide by zero encountered in log\n",
" d_1 = (np.log(s_t/K) + 0.5*(r + (sigma**2)/6)*(T-T_0))/(sigma*np.sqrt((T-T_0)/3))\n",
"C:\\Users\\Pawel\\AppData\\Local\\Temp\\ipykernel_15556\\3701205595.py:3: RuntimeWarning: divide by zero encountered in log\n",
"C:\\Users\\Pawel\\AppData\\Local\\Temp\\ipykernel_9444\\3701205595.py:3: RuntimeWarning: divide by zero encountered in log\n",
" d1 = ((T-T_0) * np.log(s_wave_t/K) + 0.5 * (r - 0.5 * sigma**2) * (T-t)**2 + (sigma**2 * (T-t)**3)/(3*(T-T_0)))/(sigma * np.sqrt(((T-t)**3)/3))\n",
"C:\\Users\\Pawel\\AppData\\Local\\Temp\\ipykernel_15556\\3701205595.py:4: RuntimeWarning: divide by zero encountered in log\n",
"C:\\Users\\Pawel\\AppData\\Local\\Temp\\ipykernel_9444\\3701205595.py:4: RuntimeWarning: divide by zero encountered in log\n",
" d2 = ((T-T_0) * np.log(s_wave_t/K) + 0.5 * (r - 0.5 * sigma**2) * (T-t)**2)/(sigma * np.sqrt(((T-t)**3)/3))\n"
]
},
Expand All @@ -482,13 +487,13 @@
"output_type": "display_data"
}
],
"execution_count": 10
"execution_count": 16
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:13:35.301539Z",
"start_time": "2024-12-04T14:13:35.287375Z"
"end_time": "2025-01-09T23:25:47.689023Z",
"start_time": "2025-01-09T23:25:47.673934Z"
}
},
"cell_type": "code",
Expand All @@ -508,13 +513,13 @@
]
}
],
"execution_count": 11
"execution_count": 17
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:13:43.144472Z",
"start_time": "2024-12-04T14:13:43.126083Z"
"end_time": "2025-01-09T23:25:47.741756Z",
"start_time": "2025-01-09T23:25:47.691829Z"
}
},
"cell_type": "code",
Expand All @@ -525,13 +530,13 @@
],
"id": "f669df2ce648a8b7",
"outputs": [],
"execution_count": 12
"execution_count": 18
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-04T14:13:44.593531Z",
"start_time": "2024-12-04T14:13:44.587490Z"
"end_time": "2025-01-09T23:25:47.758537Z",
"start_time": "2025-01-09T23:25:47.742141Z"
}
},
"cell_type": "code",
Expand All @@ -546,15 +551,20 @@
]
}
],
"execution_count": 13
"execution_count": 19
},
{
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-09T23:25:47.767921Z",
"start_time": "2025-01-09T23:25:47.759787Z"
}
},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "7d10fa61a8a7f567"
"id": "7d10fa61a8a7f567",
"outputs": [],
"execution_count": 19
}
],
"metadata": {
Expand Down

0 comments on commit dd129a7

Please sign in to comment.