From 2e4d1d853c440f029ea59e93302971d3cb4436ff Mon Sep 17 00:00:00 2001 From: Davit Potoyan Date: Thu, 7 Dec 2023 20:25:29 +0000 Subject: [PATCH] 'make all ch' --- ch05/hydrogen_wavefunctions.ipynb | 57 +++++++++++++++++-------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/ch05/hydrogen_wavefunctions.ipynb b/ch05/hydrogen_wavefunctions.ipynb index 570f10ac..ac6291f9 100644 --- a/ch05/hydrogen_wavefunctions.ipynb +++ b/ch05/hydrogen_wavefunctions.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 2, "id": "66432757", "metadata": { "id": "66432757" @@ -37,9 +37,10 @@ } ], "source": [ - "import matplotlib.pyplot as plt\n", "import numpy as np\n", + "import matplotlib.pyplot as plt\n", "import plotly.graph_objects as go\n", + "from scipy.special import sph_harm, genlaguerre, factorial\n", "\n", "%matplotlib inline\n", "%config InlineBackend.figure_format = 'retina'\n", @@ -72,7 +73,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 3, "id": "64b5614e", "metadata": { "id": "64b5614e" @@ -87,7 +88,6 @@ " n: principal quantum number Int (1,2,3... inf)\n", " l: angular quantum number Int (0,1,2,... n-1)\n", " '''\n", - " from scipy.special import genlaguerre, factorial\n", " \n", " a0 = 1 # set Bohr radius to 1 (Hartree units)\n", "\n", @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 4, "id": "1d3fa3c2", "metadata": {}, "outputs": [ @@ -113,7 +113,7 @@ "Text(0, 0.5, '$R_nl(r) r^2$')" ] }, - "execution_count": 39, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" }, @@ -154,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -171,14 +171,24 @@ "\n", "Rnl = radial_function(r, n=5, l=3)\n", "\n", - "pr = r**2 * Rnl**2 * dr\n", + "pr = r**2 * Rnl**2 \n", "\n", - "norm = np.trapz(pr) # Check normalizaton\n", - "#cdf = np.cumsum(pr) \n", + "norm = np.trapz(pr * dr) # Check normalizaton\n", + "#cdf = np.cumsum(pr * dr) \n", "\n", "print(norm)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "cce6661c", + "metadata": {}, + "outputs": [], + "source": [ + "np.trapz(pr*r*dr)" + ] + }, { "cell_type": "markdown", "id": "50b64906", @@ -206,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -215,20 +225,18 @@ "(0.28209479177387814+0j)" ] }, - "execution_count": 43, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "from scipy.special import sph_harm\n", - "\n", "sph_harm(0, 0, np.pi, np.pi) # test a few spherical harmonics" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "00641d96", "metadata": {}, "outputs": [], @@ -271,7 +279,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 13, "id": "5ba0e196", "metadata": {}, "outputs": [ @@ -42005,9 +42013,9 @@ } }, "text/html": [ - "