Skip to content

Commit

Permalink
updated notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
znicolaou committed Jun 7, 2022
1 parent f43833a commit 0e6ed24
Showing 1 changed file with 14 additions and 41 deletions.
55 changes: 14 additions & 41 deletions examples/9_sindypi_with_sympy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,6 @@
"This reason this modified optimization is required is that linear terms in $\\dot{x}$ are no longer guaranteed, so every candidate library term is fit with a different model to find the best combination of implicit terms. Note $\\text{diag}(\\Xi) = 0$ is required because without this, the model would just fit every candidate library term with itself, $\\dot{x} = \\dot{x}$, $x\\dot{x} = x\\dot{x}$, $x^2\\dot{x} = x^2\\dot{x}$, and so on."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -302,7 +295,7 @@
},
{
"cell_type": "code",
"execution_count": 145,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -318,18 +311,17 @@
"Model 6\n",
"Model 7\n",
"Model 8\n",
"Solver failed on model 8 , setting coefs to zeros\n",
"Model 9\n",
"1 = 5.000 x0 + 1.667 x0_t + 5.556 x0x0_t\n",
"x0 = 0.200 1 + 0.005 x0x0 + -0.334 x0_t + -1.104 x0x0_t\n",
"x0x0 = 0.019 1 + 0.079 x0 + 0.625 x0x0x0 + -0.672 x0x0_t\n",
"x0x0x0 = -0.008 1 + 0.371 x0x0 + 0.827 x0x0x0x0 + 0.033 x0_t\n",
"x0x0x0x0 = -0.005 1 + 0.858 x0x0x0 + -0.022 x0_t + 0.294 x0x0_t + -0.110 x0x0x0x0x0_t\n",
"x0_t = 0.599 1 + -2.996 x0 + 0.015 x0x0 + -3.307 x0x0_t\n",
"x0x0_t = 0.177 1 + -0.882 x0 + -0.014 x0x0 + -0.293 x0_t\n",
"x0x0x0_t = 0.013 1 + -0.246 x0x0 + -0.406 x0x0x0 + -0.043 x0_t\n",
"x0x0x0x0_t = 0.000\n",
"x0x0x0x0x0_t = 0.001 1 + -0.492 x0x0x0x0 + 0.007 x0_t + -0.068 x0x0_t\n"
"1 = 5.000 x0 + 1.667 x0_t + 5.555 x0x0_t\n",
"x0 = 0.200 1 + 0.010 x0x0 + -0.334 x0_t + -1.097 x0x0_t\n",
"x0x0 = 0.019 1 + 0.080 x0 + 0.627 x0x0x0 + -0.669 x0x0_t\n",
"x0x0x0 = -0.008 1 + 0.373 x0x0 + 0.823 x0x0x0x0 + 0.033 x0_t\n",
"x0x0x0x0 = -0.006 1 + 0.893 x0x0x0 + -0.021 x0_t + 0.305 x0x0_t\n",
"x0_t = 0.597 1 + -2.991 x0 + 0.031 x0x0 + -3.279 x0x0_t\n",
"x0x0_t = 0.174 1 + -0.863 x0 + -0.029 x0x0 + -0.285 x0_t\n",
"x0x0x0_t = 0.013 1 + -0.247 x0x0 + -0.405 x0x0x0 + -0.043 x0_t\n",
"x0x0x0x0_t = 0.010 x0 + -0.143 x0x0x0 + -0.501 x0x0x0x0 + -0.006 x0_t\n",
"x0x0x0x0x0_t = 0.001 1 + -0.479 x0x0x0x0 + 0.005 x0_t + -0.060 x0x0_t\n"
]
},
{
Expand All @@ -347,24 +339,12 @@
" 'x0x0x0x0x0_t']"
]
},
"execution_count": 145,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"library_functions = [\n",
" lambda x: x,\n",
" lambda x, y: x * y,\n",
" lambda x: x ** 2,\n",
" lambda x, y, z: x * y * z,\n",
" lambda x, y: x * y ** 2,\n",
" lambda x: x ** 3,\n",
" lambda x, y, z, w: x * y * z * w,\n",
" lambda x, y, z: x * y * z ** 2,\n",
" lambda x, y: x * y ** 3,\n",
" lambda x: x ** 4,\n",
"]\n",
"library_function_names = [\n",
" lambda x: x,\n",
" lambda x, y: x + y,\n",
Expand All @@ -378,13 +358,6 @@
" lambda x: x + x + x + x,\n",
"]\n",
"\n",
"sindy_opt = ps.SINDyPI(\n",
" threshold=1e-6,\n",
" tol=1e-9,\n",
" thresholder=\"l1\",\n",
" max_iter=20000,\n",
")\n",
"\n",
"sindy_library = ps.WeakPDELibrary(\n",
" library_functions=library_functions,\n",
" spatiotemporal_grid=t[:,np.newaxis],\n",
Expand All @@ -406,7 +379,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -451,7 +424,7 @@
" 'x0x0x0x0x0_t']"
]
},
"execution_count": 14,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit 0e6ed24

Please sign in to comment.