diff --git a/ch06/demo_lin_var.ipynb b/ch06/demo_lin_var.ipynb index 1eb360d0..62cc19f2 100644 --- a/ch06/demo_lin_var.ipynb +++ b/ch06/demo_lin_var.ipynb @@ -168,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 42, "metadata": {}, "outputs": [ { @@ -185,20 +185,20 @@ "num_basis_functions = 2\n", "\n", "# Compute the overlap matrix and Hamiltonian matrix\n", - "overlap_matrix = np.zeros((num_basis_functions, num_basis_functions))\n", - "hamiltonian_matrix = np.zeros((num_basis_functions, num_basis_functions))\n", + "S = np.zeros((num_basis_functions, num_basis_functions))\n", + "H = np.zeros((num_basis_functions, num_basis_functions))\n", "\n", "for i in range(num_basis_functions):\n", " for j in range(num_basis_functions):\n", "\n", " fi, fj = basis_functions(x, i), basis_functions(x, j)\n", "\n", - " overlap_matrix[i, j] = np.trapz(fi * fj, x=x)\n", + " S[i, j] = np.trapz(fi * fj, x=x)\n", "\n", - " hamiltonian_matrix[i, j] = np.trapz(fi * KE(fj, dx) + fi * PE(fj, x), x=x)\n", + " H[i, j] = np.trapz(fi * KE(fj, dx) + fi * PE(fj, x), x=x)\n", "\n", "# Diagonalize the matrices to find eigenvalues and eigenvectors\n", - "eigenvalues, eigenvectors = eigh(hamiltonian_matrix, overlap_matrix)\n", + "eigenvalues, eigenvectors = eigh(H, S)\n", "\n", "# Find the ground-state energy (lowest eigenvalue) and corresponding eigenfunction\n", "ground_state_energy = eigenvalues[0]\n", @@ -212,7 +212,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### visualize Eigenfunctions and eigenvalues" + "### Visualize Eigenfunctions and eigenvalues" ] }, { @@ -266,13 +266,6 @@ "ax2.set_xlim(-3, 4)\n", "ax2.set_title('Energy levels')" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {