Skip to content

Commit b968752

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3ed7ccb commit b968752

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

content/week01_intro/cleanup_bessel.ipynb

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,36 @@
2020
"from numpy import *\n",
2121
"import matplotlib.pyplot as plt\n",
2222
"\n",
23-
"Xmax = 40.\n",
23+
"Xmax = 40.0\n",
2424
"Xmin = 0.25\n",
25-
"step = 0.1 # Global class variables\n",
26-
"order = 10; start = 50 # Plot j_order\n",
27-
"graph1, ax1 = plt.subplots(figsize = (5, 5))\n",
28-
"ax1.set_title('Sperical Bessel, \\\n",
29-
" L = 1 (red), 10')\n",
30-
"ax1.set_xlabel(\"x\"); ax1.set_ylabel('j(x)')\n",
31-
"ax1.set_xlim(left=Xmin , \\\n",
32-
" right=Xmax)\n",
33-
"ax1.set_ylim(bottom=-0.2 , top=0.5)\n",
34-
"\n",
35-
"\n",
36-
"def down(x, n, m): # Method down, recurs downward\n",
37-
" j = zeros( (start + 2), float)\n",
38-
" j[m + 1] = j[m] = 1. # Start with anything\n",
39-
" for k in range(m, 0, -1):\n",
40-
" j[k - 1] = ( (2.*k + 1.)/x)*j[k] - j[k + 1]\n",
41-
" scale = (sin(x)/x)/j[0] # Scale solution to known j[0]\n",
25+
"step = 0.1 # Global class variables\n",
26+
"order = 10\n",
27+
"start = 50 # Plot j_order\n",
28+
"graph1, ax1 = plt.subplots(figsize=(5, 5))\n",
29+
"ax1.set_title(\n",
30+
" \"Spherical Bessel, \\\n",
31+
" L = 1 (red), 10\"\n",
32+
")\n",
33+
"ax1.set_xlabel(\"x\")\n",
34+
"ax1.set_ylabel(\"j(x)\")\n",
35+
"ax1.set_xlim(left=Xmin, right=Xmax)\n",
36+
"ax1.set_ylim(bottom=-0.2, top=0.5)\n",
37+
"\n",
38+
"\n",
39+
"def down(x, n, m): # Method down, recurs downward\n",
40+
" j = zeros((start + 2), float)\n",
41+
" j[m + 1] = j[m] = 1.0 # Start with anything\n",
42+
" for k in range(m, 0, -1):\n",
43+
" j[k - 1] = ((2.0 * k + 1.0) / x) * j[k] - j[k + 1]\n",
44+
" scale = (sin(x) / x) / j[0] # Scale solution to known j[0]\n",
4245
" return j[n] * scale\n",
4346
"\n",
4447
"\n",
4548
"for x in arange(Xmin, Xmax, step):\n",
4649
" ax1.plot(x, down(x, order, start), \"r.\")\n",
4750
"\n",
4851
"for x in arange(Xmin, Xmax, step):\n",
49-
" ax1.plot(x, down(x,1,start), \"g.\")\n",
52+
" ax1.plot(x, down(x, 1, start), \"g.\")\n",
5053
"\n",
5154
"plt.show()"
5255
]

0 commit comments

Comments
 (0)