Skip to content

Commit 24262ea

Browse files
committed
Added additional notebook
1 parent 46335f8 commit 24262ea

File tree

2 files changed

+130
-3
lines changed

2 files changed

+130
-3
lines changed

test/plot_normal_recurrence.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 5,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -13,7 +13,7 @@
1313
" make_identity_diff_op,\n",
1414
")\n",
1515
"\n",
16-
"from sumpy.recurrence import get_recurrence\n",
16+
"from sumpy.recurrence import get_recurrence, _generate_nd_derivative_relations, pde_to_ode_in_r, ode_in_r_to_x\n",
1717
"\n",
1818
"import sympy as sp\n",
1919
"from sympy import hankel1\n",
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": 2,
31+
"execution_count": null,
3232
"metadata": {},
3333
"outputs": [],
3434
"source": [

test/testing_pde_to_ode.ipynb

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from sumpy.recurrence import _make_sympy_vec, get_processed_and_shifted_recurrence\n",
10+
"\n",
11+
"from sumpy.expansion.diff_op import (\n",
12+
" laplacian,\n",
13+
" make_identity_diff_op,\n",
14+
")\n",
15+
"\n",
16+
"from sumpy.recurrence import get_recurrence, _generate_nd_derivative_relations, pde_to_ode_in_r, ode_in_r_to_x\n",
17+
"\n",
18+
"import sympy as sp\n",
19+
"from sympy import hankel1\n",
20+
"\n",
21+
"import numpy as np\n",
22+
"\n",
23+
"import math\n",
24+
"\n",
25+
"import matplotlib.pyplot as plt\n",
26+
"from matplotlib import cm, ticker"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": 10,
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"from sumpy.expansion.diff_op import DerivativeIdentifier, LinearPDESystemOperator\n",
36+
"from immutabledict import immutabledict"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": 22,
42+
"metadata": {},
43+
"outputs": [],
44+
"source": [
45+
"def get_ode_in_x(x_order, y_order):\n",
46+
" single_partial = DerivativeIdentifier((x_order,y_order), 0)\n",
47+
" #Coefficients\n",
48+
" list_pde_dict = immutabledict({single_partial: 1})\n",
49+
" random_pde = LinearPDESystemOperator(2,(list_pde_dict,))\n",
50+
"\n",
51+
" ode_in_r_random, var, ode_order_random = pde_to_ode_in_r(random_pde)\n",
52+
" ode_in_x_random = ode_in_r_to_x(ode_in_r_random, var, ode_order_random).simplify()\n",
53+
"\n",
54+
" return ode_in_x_random"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"execution_count": 29,
60+
"metadata": {},
61+
"outputs": [],
62+
"source": [
63+
"size = 3\n",
64+
"table = []\n",
65+
"for i in range(size):\n",
66+
" temp = []\n",
67+
" for j in range(size):\n",
68+
" temp.append(get_ode_in_x(i, j))\n",
69+
" table.append(temp)"
70+
]
71+
},
72+
{
73+
"cell_type": "code",
74+
"execution_count": 30,
75+
"metadata": {},
76+
"outputs": [
77+
{
78+
"data": {
79+
"text/plain": [
80+
"[[f_x0, f_x1*x1/x0, (f_x1*x0**2 - f_x1*x1**2 + f_x2*x0*x1**2)/x0**3],\n",
81+
" [f_x1,\n",
82+
" x1*(-f_x1 + f_x2*x0)/x0**2,\n",
83+
" (-f_x1*x0**2 + 3*f_x1*x1**2 + f_x2*x0**3 - 3*f_x2*x0*x1**2 + f_x3*x0**2*x1**2)/x0**4],\n",
84+
" [f_x2,\n",
85+
" x1*(2*f_x1 - 2*f_x2*x0 + f_x3*x0**2)/x0**3,\n",
86+
" (2*f_x1*x0**2 - 12*f_x1*x1**2 - 2*f_x2*x0**3 + 12*f_x2*x0*x1**2 + f_x3*x0**4 - 5*f_x3*x0**2*x1**2 + f_x4*x0**3*x1**2)/x0**5]]"
87+
]
88+
},
89+
"execution_count": 30,
90+
"metadata": {},
91+
"output_type": "execute_result"
92+
}
93+
],
94+
"source": [
95+
"table"
96+
]
97+
},
98+
{
99+
"cell_type": "code",
100+
"execution_count": null,
101+
"metadata": {},
102+
"outputs": [],
103+
"source": []
104+
}
105+
],
106+
"metadata": {
107+
"kernelspec": {
108+
"display_name": "inteq",
109+
"language": "python",
110+
"name": "python3"
111+
},
112+
"language_info": {
113+
"codemirror_mode": {
114+
"name": "ipython",
115+
"version": 3
116+
},
117+
"file_extension": ".py",
118+
"mimetype": "text/x-python",
119+
"name": "python",
120+
"nbconvert_exporter": "python",
121+
"pygments_lexer": "ipython3",
122+
"version": "3.11.9"
123+
}
124+
},
125+
"nbformat": 4,
126+
"nbformat_minor": 2
127+
}

0 commit comments

Comments
 (0)