Skip to content

Commit 0e6ed24

Browse files
committed
updated notebook
1 parent f43833a commit 0e6ed24

File tree

1 file changed

+14
-41
lines changed

1 file changed

+14
-41
lines changed

examples/9_sindypi_with_sympy.ipynb

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,6 @@
165165
"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."
166166
]
167167
},
168-
{
169-
"cell_type": "code",
170-
"execution_count": null,
171-
"metadata": {},
172-
"outputs": [],
173-
"source": []
174-
},
175168
{
176169
"cell_type": "code",
177170
"execution_count": 3,
@@ -302,7 +295,7 @@
302295
},
303296
{
304297
"cell_type": "code",
305-
"execution_count": 145,
298+
"execution_count": 5,
306299
"metadata": {},
307300
"outputs": [
308301
{
@@ -318,18 +311,17 @@
318311
"Model 6\n",
319312
"Model 7\n",
320313
"Model 8\n",
321-
"Solver failed on model 8 , setting coefs to zeros\n",
322314
"Model 9\n",
323-
"1 = 5.000 x0 + 1.667 x0_t + 5.556 x0x0_t\n",
324-
"x0 = 0.200 1 + 0.005 x0x0 + -0.334 x0_t + -1.104 x0x0_t\n",
325-
"x0x0 = 0.019 1 + 0.079 x0 + 0.625 x0x0x0 + -0.672 x0x0_t\n",
326-
"x0x0x0 = -0.008 1 + 0.371 x0x0 + 0.827 x0x0x0x0 + 0.033 x0_t\n",
327-
"x0x0x0x0 = -0.005 1 + 0.858 x0x0x0 + -0.022 x0_t + 0.294 x0x0_t + -0.110 x0x0x0x0x0_t\n",
328-
"x0_t = 0.599 1 + -2.996 x0 + 0.015 x0x0 + -3.307 x0x0_t\n",
329-
"x0x0_t = 0.177 1 + -0.882 x0 + -0.014 x0x0 + -0.293 x0_t\n",
330-
"x0x0x0_t = 0.013 1 + -0.246 x0x0 + -0.406 x0x0x0 + -0.043 x0_t\n",
331-
"x0x0x0x0_t = 0.000\n",
332-
"x0x0x0x0x0_t = 0.001 1 + -0.492 x0x0x0x0 + 0.007 x0_t + -0.068 x0x0_t\n"
315+
"1 = 5.000 x0 + 1.667 x0_t + 5.555 x0x0_t\n",
316+
"x0 = 0.200 1 + 0.010 x0x0 + -0.334 x0_t + -1.097 x0x0_t\n",
317+
"x0x0 = 0.019 1 + 0.080 x0 + 0.627 x0x0x0 + -0.669 x0x0_t\n",
318+
"x0x0x0 = -0.008 1 + 0.373 x0x0 + 0.823 x0x0x0x0 + 0.033 x0_t\n",
319+
"x0x0x0x0 = -0.006 1 + 0.893 x0x0x0 + -0.021 x0_t + 0.305 x0x0_t\n",
320+
"x0_t = 0.597 1 + -2.991 x0 + 0.031 x0x0 + -3.279 x0x0_t\n",
321+
"x0x0_t = 0.174 1 + -0.863 x0 + -0.029 x0x0 + -0.285 x0_t\n",
322+
"x0x0x0_t = 0.013 1 + -0.247 x0x0 + -0.405 x0x0x0 + -0.043 x0_t\n",
323+
"x0x0x0x0_t = 0.010 x0 + -0.143 x0x0x0 + -0.501 x0x0x0x0 + -0.006 x0_t\n",
324+
"x0x0x0x0x0_t = 0.001 1 + -0.479 x0x0x0x0 + 0.005 x0_t + -0.060 x0x0_t\n"
333325
]
334326
},
335327
{
@@ -347,24 +339,12 @@
347339
" 'x0x0x0x0x0_t']"
348340
]
349341
},
350-
"execution_count": 145,
342+
"execution_count": 5,
351343
"metadata": {},
352344
"output_type": "execute_result"
353345
}
354346
],
355347
"source": [
356-
"library_functions = [\n",
357-
" lambda x: x,\n",
358-
" lambda x, y: x * y,\n",
359-
" lambda x: x ** 2,\n",
360-
" lambda x, y, z: x * y * z,\n",
361-
" lambda x, y: x * y ** 2,\n",
362-
" lambda x: x ** 3,\n",
363-
" lambda x, y, z, w: x * y * z * w,\n",
364-
" lambda x, y, z: x * y * z ** 2,\n",
365-
" lambda x, y: x * y ** 3,\n",
366-
" lambda x: x ** 4,\n",
367-
"]\n",
368348
"library_function_names = [\n",
369349
" lambda x: x,\n",
370350
" lambda x, y: x + y,\n",
@@ -378,13 +358,6 @@
378358
" lambda x: x + x + x + x,\n",
379359
"]\n",
380360
"\n",
381-
"sindy_opt = ps.SINDyPI(\n",
382-
" threshold=1e-6,\n",
383-
" tol=1e-9,\n",
384-
" thresholder=\"l1\",\n",
385-
" max_iter=20000,\n",
386-
")\n",
387-
"\n",
388361
"sindy_library = ps.WeakPDELibrary(\n",
389362
" library_functions=library_functions,\n",
390363
" spatiotemporal_grid=t[:,np.newaxis],\n",
@@ -406,7 +379,7 @@
406379
},
407380
{
408381
"cell_type": "code",
409-
"execution_count": 14,
382+
"execution_count": 6,
410383
"metadata": {},
411384
"outputs": [
412385
{
@@ -451,7 +424,7 @@
451424
" 'x0x0x0x0x0_t']"
452425
]
453426
},
454-
"execution_count": 14,
427+
"execution_count": 6,
455428
"metadata": {},
456429
"output_type": "execute_result"
457430
}

0 commit comments

Comments
 (0)