Final: WIP: Fix comments in task 3.1 and execution numbers

This commit is contained in:
2022-03-30 09:19:00 +02:00
parent 7f12a5cfe9
commit 1d4130d7b6

View File

@ -86,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {
"deletable": false,
"nbgrader": {
@ -135,7 +135,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {
"deletable": false,
"nbgrader": {
@ -202,7 +202,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {
"deletable": false,
"nbgrader": {
@ -289,7 +289,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {
"deletable": false,
"nbgrader": {
@ -342,7 +342,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {
"deletable": false,
"nbgrader": {
@ -398,7 +398,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"metadata": {
"deletable": false,
"nbgrader": {
@ -606,7 +606,7 @@
},
{
"cell_type": "code",
"execution_count": 118,
"execution_count": 7,
"metadata": {
"deletable": false,
"nbgrader": {
@ -640,9 +640,12 @@
" for x_i in positions:\n",
" ret += -1./(np.abs(x - x_i) + 0.001)\n",
" return ret\n",
" # Instead of using a loop, one could vectorize the problem by calculating all sum\n",
" # elements in a len(x) by len(positions) matrix and then summing along the rows.\n",
" # Instead of using a loop, one could vectorize the problem further by calculating all sum\n",
" # terms as elements of a len(x) by len(positions) matrix and then summing along the rows.\n",
" # In testing I found that this was slower than using the loop, so I commented it out.\n",
" # This might be due to the large memory overhead O(len(x)*len(positions)), and the fact that\n",
" # the len(positions) iterations already do vectorized calculations on len(x) >> len(positions)\n",
" # numbers, making the theoretical speed gain only plausible at larger len(positions). \n",
" #V = lambda x: np.sum( -1/( np.abs(np.subtract.outer(x, positions)) + 0.001 ), axis=1 )\n",
" \n",
" integrand = lambda x: atomic_basis(x, positions[i], sigma)*V(x)*atomic_basis(x, positions[j], sigma)\n",
@ -660,7 +663,7 @@
},
{
"cell_type": "code",
"execution_count": 119,
"execution_count": 8,
"metadata": {
"deletable": false,
"nbgrader": {