Skip to content

Commit

Permalink
Merge pull request #329 from osscar-org/shooting_method_review
Browse files Browse the repository at this point in the history
Fixed matplotlib errors in shooting method notebook. Resolved issue w…
  • Loading branch information
Taylor-96 authored May 4, 2024
2 parents f91fc72 + e22b3f4 commit e966bb1
Showing 1 changed file with 73 additions and 14 deletions.
87 changes: 73 additions & 14 deletions notebook/quantum-mechanics/shooting_method.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -221,9 +221,38 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0c205274437f4883b6b9a654632ebc51",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(VBox(children=(Label(value='Targeted eigenvalue'), HBox(children=(FloatSlider(value=-0.03, layo…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7befa6aa973542e698ef88e678524448",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"mu = 0.06 # Potential parameter\n",
"L = 1.5 # x range [-L,L]\n",
Expand Down Expand Up @@ -363,8 +392,8 @@
"\n",
"def on_width_change(change):\n",
" global ew, ef, x, dx, V\n",
" ax[0].lines.clear()\n",
" ax[1].lines.clear()\n",
" ax[0].clear()\n",
" ax[1].clear()\n",
" \n",
" try:\n",
" ann.remove()\n",
Expand All @@ -377,8 +406,8 @@
"\n",
"def on_depth_change(change):\n",
" global ew, ef, x, dx, V\n",
" ax[0].lines.clear()\n",
" ax[1].lines.clear()\n",
" ax[0].clear()\n",
" ax[1].clear()\n",
" \n",
" try:\n",
" ann.remove()\n",
Expand All @@ -391,8 +420,8 @@
" loop1.max = max(V)\n",
" \n",
"def on_xfak_change(change):\n",
" ax[0].lines.clear()\n",
" ax[1].lines.clear()\n",
" ax[0].clear()\n",
" ax[1].clear()\n",
" \n",
" try:\n",
" ann.remove()\n",
Expand Down Expand Up @@ -455,7 +484,8 @@
"label3 = Label(value=\"(click on a state to select it)\")\n",
"label4 = Label(value=\"(tune to zoom the eigenfunctions)\")\n",
"\n",
"display(HBox([VBox([label1, HBox([loop1, loop2, loop3, loop4]), Leng, search, order, label2, flip]), output]))"
"full_layout=HBox([VBox([label1, HBox([loop1, loop2, loop3, loop4]), Leng, search, order, label2, flip]),output])\n",
"display(full_layout)"
]
},
{
Expand All @@ -467,9 +497,38 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d36195895f1c408c806c02869c447a75",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(FloatSlider(value=1.2, description='Width: ', max=2.0, min=0.1), FloatSlider(value=0.2, descrip…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "028876bb1fec458ab2cf5bc547bd4011",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(FloatSlider(value=3.0, description='Zoom factor: ', max=5.0, min=1.0, step=0.5),…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(HBox([swidth, sdepth]), VBox([HBox([sfak, label4]), HBox([update, label3])]))"
]
Expand Down Expand Up @@ -535,7 +594,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.10.12"
},
"voila": {
"authors": "Dou Du and Giovanni Pizzi"
Expand Down

0 comments on commit e966bb1

Please sign in to comment.