{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ENERGY EIGENVALUES OF SPIKED HARMONIC
OSCILLATOR POTENTIALS USING AIMpy CODE\n",
"\n",
"M. Karakoc\n",
"\n",
"Presented at https://technoscience2020.weebly.com/live-hall.html\n",
"\n",
"**Reference:** \n",
"ASYMPTOTIC ITERATION METHOD FOR SINGULAR POTENTIALS \n",
"B. Champion, R. L. Hall, N. Saad, Int. J. Mod. Phys. A 2008.23:1405-1415. \n",
"https://www.worldscientific.com/doi/abs/10.1142/S0217751X08039852"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import AIM library "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:00.726216Z",
"start_time": "2020-12-14T06:42:57.499835Z"
},
"pycharm": {
"is_executing": false
}
},
"outputs": [],
"source": [
"# Python program to use AIM tools\n",
"from asymptotic import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Definitions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Variables"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:00.752850Z",
"start_time": "2020-12-14T06:43:00.730024Z"
}
},
"outputs": [],
"source": [
"# symengine (symbolic) variables for lambda_0 and s_0 \n",
"En, r = se.symbols(\"En, r\")\n",
"r0, m, λ, γ = se.symbols(\"r0, m, λ, γ\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### $\\lambda_0$ and $s_0$"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:00.923685Z",
"start_time": "2020-12-14T06:43:00.762087Z"
}
},
"outputs": [],
"source": [
"# lambda_0 and s_0\n",
"l0 = 2*r - 2*se.sqrt(λ)/r**(m+1) - (1 + m)/r\n",
"s0 = se.expand(2 + m + 2*se.sqrt(λ)/r**m + ((2*γ+1-m)*(2*γ+1+m))/(4*r**2) - En)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Case: $\\alpha = 3, m = 1/2, \\gamma = 2, \\lambda = 0.1, r_0 = 3$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Numerical values for variables¶"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:00.999215Z",
"start_time": "2020-12-14T06:43:00.926861Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"nα = 3\n"
]
}
],
"source": [
"nr0 = o* 3\n",
"nλ = o* 1/10\n",
"nm = o* 1/2\n",
"nγ = o* 2\n",
"nα = 2* (nm + 1) \n",
"print('nα =', nα)\n",
"# parameters of lambda_0 (pl0) and s_0 (ps0)\n",
"pl0 = {λ: nλ, m:nm}\n",
"ps0 = {λ: nλ, m:nm, γ:nγ}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Initialize AIM solver"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:23.397325Z",
"start_time": "2020-12-14T06:43:23.351822Z"
}
},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\text{Values of the parameters of } \\lambda_0:$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle m = 1/2,~~λ = 1/10$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle \\text{Values of the parameters of } s_0:$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle m = 1/2,~~γ = 2,~~λ = 1/10$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle \n",
" \\begin{align}\n",
" \\lambda_0 &= \\left[2 r - 2 r^{- m - 1} \\sqrt{λ} - \\frac{m + 1}{r} \\right.\\\\ \n",
" s_0 &= \\left[- En - \\frac{m^{2}}{4 r^{2}} + m + 2 + 2 r^{- m} \\sqrt{λ} + \\frac{γ^{2}}{r^{2}} + \\frac{γ}{r^{2}} + \\frac{1}{4 r^{2}} \\right.\\\\ \n",
" \\lambda_0 &= \\left[2 r - \\frac{3}{2 r} - \\frac{\\sqrt{10}}{5 r^{\\frac{3}{2}}} \\right.\\\\ \n",
" s_0 &= \\left[- En + \\frac{0.632455532033676}{r^{0.5}} + 2.5 + \\frac{6.1875}{r^{2}} \\right.\n",
" \\end{align}\n",
" $"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 35.4 ms, sys: 7.57 ms, total: 43 ms\n",
"Wall time: 40 ms\n"
]
}
],
"source": [
"%%time\n",
"# pass lambda_0, s_0 and variable values to aim class\n",
"singular = aim(l0, s0, pl0, ps0)\n",
"singular.display_parameters()\n",
"singular.display_l0s0(0)\n",
"singular.parameters(En, r, nr0, nmax=51, nstep=10, dprec=1000, tol=1e-101)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Calculation necessary coefficients"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:26.010305Z",
"start_time": "2020-12-14T06:43:24.299432Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 1.67 s, sys: 44.5 ms, total: 1.72 s\n",
"Wall time: 1.7 s\n"
]
}
],
"source": [
"%%time\n",
"# create coefficients for improved AIM\n",
"singular.c0()\n",
"singular.d0()\n",
"singular.cndn()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The Solution"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:27.916396Z",
"start_time": "2020-12-14T06:43:27.449448Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0001 Nothing to show!\n",
"0011 7.02973188059513735627 11.03648936547943630430 15.04041036652189736957 19.07321711095311876406\n",
"0021 7.02982947034099852402 11.03612855247994084496 15.04155493165303929384 19.04639482736063484027\n",
"0031 7.02981951427064925809 11.03609370928803981381 15.04147862242408418360 19.04625968077810021276\n",
"0041 7.02981724597752740950 11.03608602982983891869 15.04146191466517811585 19.04623006883960918521\n",
"0051 7.02981662908296880128 11.03608392644196074531 15.04145730211386881369 19.04622182453015802669\n",
"CPU times: user 464 ms, sys: 3.47 ms, total: 468 ms\n",
"Wall time: 462 ms\n"
]
}
],
"source": [
"%%time\n",
"singular.get_arb_roots(showRoots='+r', printFormat=\"{:25.20f}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Case: $\\alpha = 4, m = 1, \\gamma = 0, \\lambda = 0.1, r_0 = 3$"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:34.350975Z",
"start_time": "2020-12-14T06:43:32.727742Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"nα = 4\n"
]
},
{
"data": {
"text/latex": [
"$\\displaystyle \\text{Values of the parameters of } \\lambda_0:$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle m = 1,~~λ = 1/10$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle \\text{Values of the parameters of } s_0:$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle m = 1,~~γ = 0,~~λ = 1/10$"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"$\\displaystyle \n",
" \\begin{align}\n",
" \\lambda_0 &= \\left[2 r - 2 r^{- m - 1} \\sqrt{λ} - \\frac{m + 1}{r} \\right.\\\\ \n",
" s_0 &= \\left[- En - \\frac{m^{2}}{4 r^{2}} + m + 2 + 2 r^{- m} \\sqrt{λ} + \\frac{γ^{2}}{r^{2}} + \\frac{γ}{r^{2}} + \\frac{1}{4 r^{2}} \\right.\\\\ \n",
" \\lambda_0 &= \\left[2 r - \\frac{2}{r} - \\frac{\\sqrt{10}}{5 r^{2}} \\right.\\\\ \n",
" s_0 &= \\left[- En + 3.0 + \\frac{0.632455532033676}{r} \\right.\n",
" \\end{align}\n",
" $"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0001 3.38758547388222046423 5.30312232762420610348\n",
"0011 3.58106654527694423246 7.78195832597853546903 11.92175724616384164134 16.04187545178757149818\n",
"0021 3.57616724002337265346 7.76824685204923332939 11.90159573942127471866 16.00696878448652112105\n",
"0031 3.57565387336015211993 7.76664509033522596660 11.89864924796067814980 16.00252792573594494215\n",
"0041 3.57557412207922971377 7.76637876963918045001 11.89813052512720732022 16.00170632340102846391\n",
"0051 3.57555772719302652467 7.76632244815799118832 11.89801793062055629181 16.00152359416440551749\n"
]
}
],
"source": [
"nr0 = o* 3\n",
"nλ = o* 1/10\n",
"nm = o* 1\n",
"nγ = o* 0\n",
"nα = 2* (nm + 1) \n",
"print('nα =', nα)\n",
"# parameters of lambda_0 (pl0) and s_0 (ps0)\n",
"pl0 = {λ: nλ, m:nm}\n",
"ps0 = {λ: nλ, m:nm, γ:nγ}\n",
"\n",
"# pass lambda_0, s_0 and variable values to aim class\n",
"singular = aim(l0, s0, pl0, ps0)\n",
"singular.display_parameters()\n",
"singular.display_l0s0(0)\n",
"singular.parameters(En, r, nr0, nmax=51, nstep=10, dprec=500, tol=1e-101)\n",
"\n",
"# create coefficients for improved AIM\n",
"singular.c0()\n",
"singular.d0()\n",
"singular.cndn()\n",
"\n",
"\n",
"singular.get_arb_roots(showRoots='+r', printFormat=\"{:25.20f}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Case: $\\alpha = 4, m = 1, \\gamma = 0\\ldots5$\n",
"\n",
"$r_0 = 3$\n",
"\n",
"$\\lambda = 0.001, 0.01, 0.1 ,1 ,10, 100, 1000$"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:43:34.356581Z",
"start_time": "2020-12-14T06:43:34.353035Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"nα = 4\n"
]
}
],
"source": [
"nm = o* 1\n",
"nα = 2* (nm + 1) \n",
"print('nα =', nα)\n",
"\n",
"nr0 = o* 3"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-14T06:44:38.121991Z",
"start_time": "2020-12-14T06:43:34.786807Z"
},
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[91m\u001b[1m============================== λ = 1000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 22.65370989497436125864 32.41707025566829551172\n",
"0011 21.36946266981324883157 26.15317847215010698497 30.85245592871690832384 35.57352270007154378763\n",
"0021 21.36946253226412951531 26.15317952339489677528 30.85137870782829578529 35.48269756348816657149\n",
"0031 21.36946253216371589945 26.15317952574961280995 30.85137868443687006955 35.48269769495277936777\n",
"0041 21.36946253216346631406 26.15317952576134065381 30.85137868421485698291 35.48269769730913293827\n",
"0051 21.36946253216346454201 26.15317952576150434934 30.85137868420948669540 35.48269769740239270880\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 22.85029561818829590545 32.66492897689880530935\n",
"0011 21.52285993536266546197 26.29862400486327369731 30.99163120250458156940 35.71397698361216231791\n",
"0021 21.52285981420070062960 26.29862477147847685253 30.99040221984237712474 35.61639304078133643328\n",
"0031 21.52285981411285977009 26.29862477353733952556 30.99040219940665878904 35.61639315549414695267\n",
"0041 21.52285981411264257314 26.29862477354754793301 30.99040219921338843257 35.61639315754529445362\n",
"0051 21.52285981411264103779 26.29862477354768986030 30.99040219920872924365 35.61639315762624927183\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 23.24386471181711268395 33.16024877215887741973\n",
"0011 21.82788318761440828372 26.58805102708878134051 31.26879601679997698023 35.99493251936458306014\n",
"0021 21.82788309371422921229 26.58805116884445646074 31.26720695702740131044 35.88270808589646802996\n",
"0031 21.82788309364707484310 26.58805117041698499077 31.26720694144377962604 35.88270817316208764397\n",
"0041 21.82788309364691050172 26.58805117042471321944 31.26720694129742771711 35.88270817471513503367\n",
"0051 21.82788309364690935010 26.58805117042481982612 31.26720694129392331860 35.88270817477609330254\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 23.83518240525479722182 33.90226441205452621520\n",
"0011 22.28105733893717907806 27.01857836324532669959 31.68164019353115550797 36.41667762329543422862\n",
"0021 22.28105727505970947758 27.01857725206333248191 31.67934185209019327146 36.27951558231077102846\n",
"0031 22.28105727501492865880 27.01857725311060963651 31.67934184173553500284 36.27951564008971748778\n",
"0041 22.28105727501482072143 27.01857725311568994276 31.67934184163928165853 36.27951564111105606996\n",
"0051 22.28105727501481997480 27.01857725311575921097 31.67934184163699984492 36.27951564115081787700\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 24.62532650405433188096 34.88989809103276933384\n",
"0011 22.87733471277775600281 27.58599966052730683042 32.22686403713668547349 36.98011427230062050065\n",
"0021 22.87733467480450040706 27.58599560484105337497 32.22321294882132868520 36.80368602584343489794\n",
"0031 22.87733467477852484149 27.58599560544763167506 32.22321294284126788029 36.80368605905807870197\n",
"0041 22.87733467477846345129 27.58599560545052500861 32.22321294278640618434 36.80368605964023573310\n",
"0051 22.87733467477846303382 27.58599560545056385752 32.22321294278512263001 36.80368605966265826859\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 25.61561618459377353521 36.12183063271554990181\n",
"0011 23.61028265127032737802 28.28491700506210473339 32.90041451824235565773 37.68725948402805192339\n",
"0021 23.61028263189170752240 28.28490486708062128303 32.89417943887381976629 37.45115928080145987637\n",
"0031 23.61028263187864484969 28.28490486738517868840 32.89417943588143102287 37.45115929732705744374\n",
"0041 23.61028263187861470117 28.28490486738660226620 32.89417943585440536937 37.45115929761390581795\n",
"0051 23.61028263187861450042 28.28490486738662102323 32.89417943585378320995 37.45115929762481053835\n",
"\u001b[91m\u001b[1m============================== λ = 100 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.26508106348142611411 15.94731164830926966588 20.50694210625968554260 24.98518047185737953306\n",
"0021 11.26508043178372934169 15.94730884485380117681 20.50693448538542365477 24.98516368940150024379\n",
"0031 11.26508043175284188301 15.94730884464078372145 20.50693448430819074714 24.98516368836474349013\n",
"0041 11.26508043175283812600 15.94730884464084668715 20.50693448430557986116 24.98516368839700345859\n",
"0051 11.26508043175283809599 15.94730884464085036503 20.50693448430544854747 24.98516368839915418473\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.58161820167421288456 16.23574365870076306533 20.77586292040965124504 25.23946702886457769945\n",
"0021 11.58161778111576264359 16.23574172700978099587 20.77585751297282651118 25.23947925364119804717\n",
"0031 11.58161778109638884617 16.23574172687282097315 20.77585751223621339673 25.23947925304670898815\n",
"0041 11.58161778109638642482 16.23574172687287184642 20.77585751223427185042 25.23947925307105647358\n",
"0051 11.58161778109638640279 16.23574172687287457798 20.77585751223417379281 25.23947925307267200726\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 12.19953691752818920960 16.80176427599892528756 21.30532250618471360479 25.74116337934717211832\n",
"0021 12.19953673210007737866 16.80176336603484756930 21.30531967044846219968 25.74129514272522981380\n",
"0031 12.19953673209246190133 16.80176336597875415779 21.30531967010316676762 25.74129514257193544870\n",
"0041 12.19953673209246086748 16.80176336597878556813 21.30531967010209620188 25.74129514258570876376\n",
"0051 12.19953673209246085568 16.80176336597878706324 21.30531967010204188058 25.74129514258661486536\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 13.09089053805304137517 17.62489130594610365942 22.07923899428716728947 26.47678833312855049070\n",
"0021 13.09089048424828749447 17.62489102021877286552 22.07923761109646988190 26.47739702991524848588\n",
"0031 13.09089048424640904144 17.62489102020446210051 22.07923761098457775573 26.47739702994109854629\n",
"0041 13.09089048424640873210 17.62489102020447608837 22.07923761098414303514 26.47739702994686784574\n",
"0051 13.09089048424640872754 17.62489102020447668333 22.07923761098412097459 26.47739702994724317670\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 14.21910415418123648590 18.67725124886980472214 23.07516541822218567791 27.42664745426872108136\n",
"0021 14.21910414385721137674 18.67725119073032167460 23.07516531830046783958 27.42901835373765750654\n",
"0031 14.21910414385691759525 18.67725119072816557029 23.07516531827491616565 27.42901835377197076984\n",
"0041 14.21910414385691752594 18.67725119072816992167 23.07516531827478760611 27.42901835377373381415\n",
"0051 14.21910414385691752470 18.67725119072817009104 23.07516531827478113482 27.42901835377384704854\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 15.54392598282462403776 19.92653803083815032692 24.26618946518115372406 28.56516525044589679078\n",
"0021 15.54392598171624428812 19.92653800987193478510 24.26619272364272088154 28.57312197405272518489\n",
"0031 15.54392598171621434198 19.92653800987177630267 24.26619272363848020623 28.57312197406515034604\n",
"0041 15.54392598171621433001 19.92653800987177723787 24.26619272363845288561 28.57312197406553774831\n",
"0051 15.54392598171621432978 19.92653800987177727185 24.26619272363845153429 28.57312197406556227733\n",
"\u001b[91m\u001b[1m============================== λ = 10 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 6.60678288457512305604 11.13798838465775311844 15.53519846106308276716 19.85808516862397498714\n",
"0021 6.60662278431812733832 11.13750960200377210311 15.53426843556613505474 19.85625802487977440600\n",
"0031 6.60662251309038130730 11.13750826212240144004 15.53426478860558711392 19.85625041447614450087\n",
"0041 6.60662251203402674566 11.13750825531717875351 15.53426476635066344920 19.85625036068532996691\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0051 6.60662251202507643268 11.13750825525287267082 15.53426476612056320558 19.85625036008111567873\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 7.22358267783976509927 11.67759448894606928546 16.02870565010939929202 20.31976065881166335699\n",
"0021 7.22352048538883123749 11.67737878665116042002 16.02826618904860432104 20.31860930239346126626\n",
"0031 7.22352039348136674151 11.67737826292689192820 16.02826462857122709394 20.31860582678242593641\n",
"0041 7.22352039315225539560 11.67737826047539917466 16.02826461977230935530 20.31860580403573549695\n",
"0051 7.22352039314961443782 11.67737826045345590157 16.02826461968608617672 20.31860580379302268517\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 8.35249230987786104173 12.69122614889439297035 16.96835909316811805734 21.20547234932329243849\n",
"0021 8.35248353863434561763 12.69118389704007584237 16.96825661984930597731 21.20551047985669756879\n",
"0031 8.35248352828158603228 12.69118381878480794278 16.96825634229620856181 21.20550977818148149141\n",
"0041 8.35248352825013500579 12.69118381847238167771 16.96825634095402125290 21.20550977422550436480\n",
"0051 8.35248352824990849285 12.69118381846986860505 16.96825634094218695841 21.20550977418727744827\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 9.83923250707027544033 14.06906307608160536661 18.26895389897383656991 22.44561307928238412784\n",
"0021 9.83923132148283993314 14.06906229121474753752 18.26890463801938254222 22.44708263278843055055\n",
"0031 9.83923132085785334560 14.06906228634410758095 18.26890461747290838001 22.44708257219482031995\n",
"0041 9.83923132085639257379 14.06906228632859132934 18.26890461739333621108 22.44708257191852212735\n",
"0051 9.83923132085638361485 14.06906228632848462375 18.26890461739273536554 22.44708257191619451621\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.54400011682228808400 15.69312709597409409448 19.82942436051337154137 23.96354689648673431653\n",
"0021 11.54400045147353161748 15.69312404529858295639 19.82950327336908281551 23.95567707713224650422\n",
"0031 11.54400045151941980994 15.69312404534759185510 19.82950327314282686348 23.95567707538450152819\n",
"0041 11.54400045151949277233 15.69312404534772980989 19.82950327314207966774 23.95567707537884120521\n",
"0051 11.54400045151949313471 15.69312404534773058518 19.82950327314207506244 23.95567707537880005559\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 13.37133031233517172415 17.46785439621508673124 21.55940771111076261056 25.59672924219243034149\n",
"0021 13.37133012397265120400 17.46785748909298949476 21.55925365641876808700 25.64620392406869627146\n",
"0031 13.37133012395995912080 17.46785748905257479914 21.55925365629044498838 25.64620392392926247674\n",
"0041 13.37133012395994540856 17.46785748905250015724 21.55925365629020689041 25.64620392392867451084\n",
"0051 13.37133012395994535577 17.46785748905249982884 21.55925365629020575911 25.64620392392867051840\n",
"\u001b[91m\u001b[1m============================== λ = 1 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 4.33333333333333333333 5.37037037037037037037\n",
"0011 4.49693762310529081614 8.85244433832994309343 13.10268712861854781361 17.29979205356177923048\n",
"0021 4.49423865364622902679 8.84587833173039294221 13.09206034412006003065 17.28612373648596282784\n",
"0031 4.49418057858475729262 8.84568311812555856341 13.09166756399450378180 17.28548135377248334892\n",
"0041 4.49417815970596323339 8.84567390253831455094 13.09164711699302407187 17.28544502226812048794\n",
"0051 4.49417799963634353636 8.84567326098670201201 13.09164562779102473928 17.28544226442520667789\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 5.55972873114085378925 9.77488053114639355288 13.94479927674511608668 18.08377364462227144640\n",
"0021 5.55917583945531746051 9.77349048370036956141 13.94174846332644332518 18.08276504703392295905\n",
"0031 5.55916754036957957013 9.77345709409525739804 13.94167050606209801252 18.08262176874608696877\n",
"0041 5.55916724512986890493 9.77345574104701480003 13.94166701168353714548 18.08261476761909634517\n",
"0051 5.55916722744700130824 9.77345565576193816031 13.94166678103205858149 18.08261428546301020995\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 7.22425587578131038810 11.32215679088064987850 15.40901209080575486240 19.49315859206466768001\n",
"0021 7.22428694344201157520 11.32214781300799649512 15.40928870908689446316 19.48844130380951800431\n",
"0031 7.22428715799737390520 11.32214822289276829355 15.40928868973185599331 19.48843945380421396748\n",
"0041 7.22428716365666123736 11.32214823549165946776 15.40928868894496580115 19.48843938487143785806\n",
"0051 7.22428716393685809815 11.32214823614990296409 15.40928868890179142808 19.48843938091601914781\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 9.10866652526158430030 13.15236990769884867234 17.19433626823843475236 21.22813998908145018089\n",
"0021 9.10865863567972163865 13.15237198221290183583 17.19410100067610327189 21.23409459959832144315\n",
"0031 9.10865860802421511471 13.15237186159374760187 17.19410068468111165876 21.23409396833948014046\n",
"0041 9.10865860753610394554 13.15237185905978831442 17.19410067722293356854 21.23409395166094361249\n",
"0051 9.10865860751757375882 13.15237185895770887353 17.19410067690596119028 21.23409395091623614756\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.06223983111636113490 15.08393858902711723892 19.10502551669435614594 23.13955300394206220884\n",
"0021 11.06224171669151378159 15.08393267834534771477 19.10521575107999558214 23.12611367863567152471\n",
"0031 11.06224171935447451472 15.08393269133868716255 19.10521578961621044665 23.12611376218671291494\n",
"0041 11.06224171938333347158 15.08393269151342542740 19.10521579020455102578 23.12611376365727398156\n",
"0051 11.06224171938412526533 15.08393269151855577039 19.10521579022289849796 23.12611376370577138262\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 13.04001574423477190675 17.05206336201940426331 21.06424222600942718771 25.04778259131084971064\n",
"0021 13.04001518333935389515 17.05206849254389526997 21.06401786970489117374 25.07586599292080468768\n",
"0031 13.04001518305882729886 17.05206849108805686526 21.06401786485836723844 25.07586598191024918177\n",
"0041 13.04001518305707779375 17.05206849107607075800 21.06401786481297536802 25.07586598178379383861\n",
"0051 13.04001518305704466023 17.05206849107582507680 21.06401786481197912925 25.07586598178082435789\n",
"\u001b[91m\u001b[1m============================== λ = 1/10 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.38758547388222046423 5.30312232762420610348\n",
"0011 3.58106654527694423246 7.78195832597853546903 11.92175724616384164134 16.04187545178757149818\n",
"0021 3.57616724002337265346 7.76824685204923332939 11.90159573942127471866 16.00696878448652112105\n",
"0031 3.57565387336015211993 7.76664509033522596660 11.89864924796067814980 16.00252792573594494215\n",
"0041 3.57557412207922971377 7.76637876963918045001 11.89813052512720732022 16.00170632340102846391\n",
"0051 3.57555772719302652467 7.76632244815799118832 11.89801793062055629181 16.00152359416440551749\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 4.19662101333065252920 4.93853123262021848295\n",
"0011 5.09603031554227682182 9.15356469562835902542 13.20490634686924072399 17.24636124934928756285\n",
"0021 5.09532911983128487392 9.15170858674499565432 13.20081373425781574309 17.24492752492695889924\n",
"0031 5.09529036431720210541 9.15156227282916088881 13.20049486080378387339 17.24437920049076987461\n",
"0041 5.09528582798680093293 9.15154379887587366762 13.20045201050649794695 17.24430135150762876226\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0051 5.09528505060447066018 9.15154053724091791182 13.20044423245065454389 17.24428684815587766349\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 7.02592329267247906274 11.03998699134330684509 15.05341259512807505703 19.06918503546460248844\n",
"0021 7.02596017126202370574 11.04006841676878161872 15.05377190006601716139 19.06711202814320591578\n",
"0031 7.02596107125109786204 11.04007232822602737833 15.05378163559496519329 19.06713060079105979560\n",
"0041 7.02596113838538369321 11.04007264882571417769 15.05378249515605864662 19.06713235296942641514\n",
"0051 7.02596114687494022144 11.04007269079479538261 15.05378261134551036828 19.06713259702840879779\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 9.01136843623701427978 13.01635905065295052692 17.02141328728258334162 21.02430904358863999200\n",
"0021 9.01136406938804799298 13.01635375879176680067 17.02131052827559441855 21.02623532381210637962\n",
"0031 9.01136402814271320841 13.01635354841333817424 17.02130991213998102934 21.02623396328821526472\n",
"0041 9.01136402636067870131 13.01635353813914249704 17.02130987918261461398 21.02623388424257929580\n",
"0051 9.01136402620607945364 13.01635353720973439750 17.02130987608445239475 21.02623387654128595388\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.00633534856678372635 15.00863068909649689338 19.01086011575683260896 23.01765325544725518486\n",
"0021 11.00633609671216179662 15.00862961984887180512 19.01091809886151125526 23.01320155746176466271\n",
"0031 11.00633609916456753741 15.00862963356530604800 19.01091814358339014895 23.01320166551920384593\n",
"0041 11.00633609922237720949 15.00862963394583836546 19.01091814496745950554 23.01320166923966477214\n",
"0051 11.00633609922566569430 15.00862963396862242143 19.01091814505427285925 23.01320166948329103444\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 13.00403661009388745977 17.00527444088114379789 21.00657145572916362695 25.00320755478507001124\n",
"0021 13.00403643270813404108 17.00527569080693231264 21.00651380432465646419 25.00775077792744153662\n",
"0031 13.00403643252490950433 17.00527568973022983162 21.00651380049432822120 25.00775076818479972207\n",
"0041 13.00403643252265143296 17.00527568971369701567 21.00651380042777041561 25.00775076798837372501\n",
"0051 13.00403643252256974813 17.00527568971306010564 21.00651380042505865672 25.00775076797993958744\n",
"\u001b[91m\u001b[1m============================== λ = 1/100 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.12073275087408043995 5.24963761949628993042\n",
"0011 3.20753814255833989933 7.29802200650155974245 11.36196089981961367402 15.42266375420213294731\n",
"0021 3.20577449187625633377 7.29180921871627423142 11.35346647392460857673 15.40335689599157957090\n",
"0031 3.20531262466322431223 7.29034391749676080509 11.35078746896685539369 15.39935013999182235114\n",
"0041 3.20516849418740618455 7.28986675514965042161 11.34988182192632448677 15.39795114101248771955\n",
"0051 3.20511388950142537233 7.28968269231621678072 11.34952657435300782382 15.39739368990603088028\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 3.81899623383005924045 4.99581858098475557437\n",
"0011 5.01215017183528727753 9.02125625245754193917 13.03037460377582228172 17.03784978752835358008\n",
"0021 5.01194377435932802773 9.02063389450774513934 13.02893380875098197926 17.03693915406050158220\n",
"0031 5.01192360762246649794 9.02055338446517282792 13.02875095371979579226 17.03661426890946433772\n",
"0041 5.01191957772376742082 9.02053640951077218000 13.02871063618475571046 17.03653973660363689020\n",
"0051 5.01191844686697276170 9.02053154647185909684 13.02869886004488371347 17.03651756596195447463\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 7.00264992587550374578 11.00414383641908113711 15.00558229568230525172 19.00748468772489650741\n",
"0021 7.00265796539831106502 11.00416607453812987994 15.00566649275684321347 19.00715897158699465195\n",
"0031 7.00265827281943030729 11.00416752572008948111 15.00567038254961326216 19.00716693758448931396\n",
"0041 7.00265830758305026891 11.00416770291448099246 15.00567088791663149812 19.00716803124963782478\n",
"0051 7.00265831409626185425 11.00416773703967711209 15.00567098777113784185 19.00716825261103646452\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 9.00114298069459917059 13.00165057882303890838 17.00217329191758449889 21.00238153580448006188\n",
"0021 9.00114221046611715749 13.00164926486935155692 17.00215603435392834904 21.00266256138302252236\n",
"0031 9.00114220012097052169 13.00164920954355103702 17.00215586579892071693 21.00266217477845687752\n",
"0041 9.00114219949652186469 13.00164920582853114521 17.00215585352354389941 21.00266214449247514289\n",
"0051 9.00114219942185870026 13.00164920536816185282 17.00215585195129587963 21.00266214049200994850\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.00063467107619925659 15.00086561646462574307 19.00108778101094009099 23.00205140335280421669\n",
"0021 11.00063478836475615709 15.00086551183334701273 19.00109617906558391389 23.00132678653379180846\n",
"0031 11.00063478887764617330 15.00086551481550738663 19.00109618907624887273 23.00132681147268925713\n",
"0041 11.00063478889360173858 15.00086551492297745631 19.00109618947572665596 23.00132681256907597944\n",
"0051 11.00063478889478918273 15.00086551493134995217 19.00109618950817424377 23.00132681266164517206\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 13.00040402638306793969 17.00052811654025229109 21.00066042171959749991 25.00026676433537418596\n",
"0021 13.00040400063710845022 17.00052828133001059498 21.00065255081991289783 25.00077680942345122860\n",
"0031 13.00040400060321496633 17.00052828112356616166 21.00065255006926873626 25.00077680745579856698\n",
"0041 13.00040400060268609917 17.00052828111961997159 21.00065255005309826819 25.00077680740726402117\n",
"0051 13.00040400060266201619 17.00052828111942959219 21.00065255005227672202 25.00077680740467640820\n",
"\u001b[91m\u001b[1m============================== λ = 1/1000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.03801848646566382882 5.23105229368497882795\n",
"0011 3.06919910215803401182 7.10253936900715575929 11.12633939966358696033 15.14980139787446174709\n",
"0021 3.06899476170553323327 7.10129411041919142421 11.12507778002895412183 15.14467327414725655541\n",
"0031 3.06888014438882513355 7.10092214134174758235 11.12439296984330047031 15.14364403308916435373\n",
"0041 3.06883038754336418115 7.10075543033815007449 11.12407652860051264948 15.14315603415287951624\n",
"0051 3.06880493877352491789 7.10066897416714015054 11.12391029337400050052 15.14289656312706930843\n",
"------------------------------ γ = 1 ------------------------------\n",
"0001 3.71389919695504881656 4.99961602764003828466\n",
"0011 5.00132190407423127716 9.00240179626735314726 13.00354647507176886277 17.00449451169705646199\n",
"0021 5.00129160970125729585 9.00230473105789807608 13.00331380923942038227 17.00432246453504486663\n",
"0031 5.00128797114763809207 9.00228975606721218089 13.00327886063848107147 17.00425879466051528376\n",
"0041 5.00128707980748806848 9.00228592064379968492 13.00326957321013944779 17.00424131594294093168\n",
"0051 5.00128677543589809992 9.00228458903042582261 13.00326629844782898046 17.00423506271859800142\n",
"------------------------------ γ = 2 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 7.00026549430609182735 11.00041552059549950995 15.00055919695150316186 19.00075854080417695482\n",
"0021 7.00026652488177496609 11.00041854244572419376 15.00057023752283555107 19.00072152588655280722\n",
"0031 7.00026657077933618527 11.00041876352706948362 15.00057084092170863663 19.00072278290755692841\n",
"0041 7.00026657678799454730 11.00041879459927638411 15.00057093077282421877 19.00072297996303114858\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0051 7.00026657808615415027 11.00041880148234500785 15.00057095114632631225 19.00072302563590563308\n",
"------------------------------ γ = 3 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 9.00011437301542613059 13.00016524371538527786 17.00021791366045741765 21.00023507791994833413\n",
"0021 9.00011428062730988003 13.00016507165399278714 17.00021586963508586496 21.00026668077312888206\n",
"0031 9.00011427923334467364 13.00016506409534825388 17.00021584633612467960 21.00026662672884180258\n",
"0041 9.00011427913912335258 13.00016506352989198625 17.00021584445203592785 21.00026662204272135377\n",
"0051 9.00011427912653790977 13.00016506345177073274 17.00021584418349327985 21.00026662135506427422\n",
"------------------------------ γ = 4 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 11.00006347713877475180 15.00008658660894873823 19.00010871602733432654 23.00021925056796029150\n",
"0021 11.00006349067795768604 15.00008657682592886735 19.00010966183097417313 23.00013274520679359209\n",
"0031 11.00006349074298653673 15.00008657720848389848 19.00010966312667604044 23.00013274846456284458\n",
"0041 11.00006349074520419137 15.00008657722352210317 19.00010966318293434232 23.00013274861992190458\n",
"0051 11.00006349074538483225 15.00008657722480210169 19.00010966318791906723 23.00013274863421024288\n",
"------------------------------ γ = 5 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 13.00004040654536851624 17.00005281731744925986 21.00006613654625810000 25.00002502377231026272\n",
"0021 13.00004040364650385369 17.00005283528445732932 21.00006526685404378123 25.00007769839599733258\n",
"0031 13.00004040364237701995 17.00005283525904391656 21.00006526676100087821 25.00007769814989223640\n",
"0041 13.00004040364230746154 17.00005283525852192985 21.00006526675885041225 25.00007769814340461803\n",
"0051 13.00004040364230404366 17.00005283525849480150 21.00006526675873287920 25.00007769814303302599\n"
]
}
],
"source": [
"for nλ in [o* 1000/10**gi for gi in range(7)]:\n",
" print('\\033[91m\\033[1m{linea} λ ={fnλ:>8s} {linea}\\033[0m'.format(linea = '='*30, fnλ = str(nλ)))\n",
" for nγ in [o* gi for gi in range(6)]:\n",
" print('{linea} γ ={fnγ:>2s} {linea}'.format(linea = '-'*30, fnγ = str(nγ)))\n",
" \n",
" # parameters of lambda_0 (pl0) and s_0 (ps0)\n",
" pl0 = {λ: nλ, m:nm}\n",
" ps0 = {λ: nλ, m:nm, γ:nγ}\n",
" \n",
" # pass lambda_0, s_0 and variable values to aim class\n",
" singular = aim(l0, s0, pl0, ps0)\n",
" #singular.display_parameters()\n",
" #singular.display_l0s0(0)\n",
" singular.parameters(En, r, nr0, nmax=51, nstep=10, dprec=500, tol=1e-101)\n",
" \n",
" # create coefficients for improved AIM\n",
" singular.c0()\n",
" singular.d0()\n",
" singular.cndn()\n",
" \n",
" \n",
" singular.get_arb_roots(showRoots='+r', printFormat=\"{:25.20f}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Case: $\\alpha = 1, \\gamma = 0\\ldots5$\n",
"\n",
"$\\lambda = 1000/10^n$ where $n=0\\ldots9$"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-12T20:46:23.355457Z",
"start_time": "2020-12-12T20:46:23.352364Z"
}
},
"outputs": [],
"source": [
"# symengine (symbolic) variables for lambda_0 and s_0 \n",
"En, r = se.symbols(\"En, r\")\n",
"r0, α, λ, γ = se.symbols(\"r0, α, λ, γ\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-12T20:46:23.437834Z",
"start_time": "2020-12-12T20:46:23.357001Z"
}
},
"outputs": [],
"source": [
"# lambda_0 and s_0\n",
"l0 = 2*(r - (1 + γ)/r)\n",
"s0 = 2*γ + 3 + λ/r**α - En"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-12T20:46:23.504714Z",
"start_time": "2020-12-12T20:46:23.440210Z"
}
},
"outputs": [],
"source": [
"nα = o* 1\n",
"nr0 = o* 5"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-12T20:46:38.272743Z",
"start_time": "2020-12-12T20:46:23.507487Z"
},
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[91m\u001b[1m============================== λ = 1000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 Nothing to show!\n",
"0021 195.03395173003917030237 202.07951961497884146784\n",
"0031 191.24118188335632510377 196.31296770269173409244 202.42106248241712562717 207.85322682390911414892\n",
"0041 190.73073992480037234603 194.30110930981941671388 198.23018150739304022156 202.75621392839347702255\n",
"0051 190.72331087869230294239 194.19287413715650270098 197.67115288107481147823 201.18682686241291712659\n",
"\u001b[91m\u001b[1m============================== λ = 100 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 Nothing to show!\n",
"0021 42.46291828635666106982 45.94813371111329518742\n",
"0031 42.46291811461920091219 45.95129937658562397155 49.46188280149269910044 52.99323873184068557673\n",
"0041 42.46291811461920084051 45.95129937658564374683 49.46188280149073678852 52.99323873183586368433\n",
"0051 42.46291811461920084051 45.95129937658564374683 49.46188280149073678839 52.99323873183586368423\n",
"\u001b[91m\u001b[1m============================== λ = 10 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 Nothing to show!\n",
"0011 10.57776018573453279600 14.13951351130236064948 18.39988309242623932569 21.02052526695748135018\n",
"0021 10.57748372573980976017 14.15087661244857590188 17.79624812762506677581 21.49585132763179456262\n",
"0031 10.57748353974081090442 14.15087895456055451168 17.79623297739368193511 21.49593400395197738283\n",
"0041 10.57748353937201970788 14.15087895715152506300 17.79623296887495660394 21.49593402512720569480\n",
"0051 10.57748353937115914849 14.15087895715560588842 17.79623296886626793222 21.49593402514057324852\n",
"\u001b[91m\u001b[1m============================== λ = 1 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.40477547928715598562 5.07522452071284401438\n",
"0011 4.04976641762001862436 7.93205532984973154166 11.72219247835142240671 16.76688549605732873691\n",
"0021 4.05775115633165068131 7.90980451209183572022 11.81901436863401586288 15.75637878290377965675\n",
"0031 4.05787550920531413530 7.90967468271801905223 11.81920094202961313697 15.75597529554192212685\n",
"0041 4.05787699631698914900 7.90967379575334515828 11.81920161710261301783 15.75597458561630214828\n",
"0051 4.05787700790970234875 7.90967379108476594371 11.81920161941666876777 15.75597458408995740088\n",
"\u001b[91m\u001b[1m============================== λ = 1/10 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.03862837321570362706 5.08137162678429637294\n",
"0011 3.10890614729751119789 7.09820870568901550305 11.07133827979761600697 16.73341316916574039537\n",
"0021 3.11199009916023155107 7.09376058163121599818 11.08347807920549311408 15.07672113215298457951\n",
"0031 3.11206575040445388807 7.09372317432073437764 11.08351520772917810062 15.07665742671914266195\n",
"0041 3.11206689602723277721 7.09372285603373779180 11.08351537405069080176 15.07665728819477296795\n",
"0051 3.11206690644391701263 7.09372285409949999251 11.08351537470545282050 15.07665728785360793916\n",
"\u001b[91m\u001b[1m============================== λ = 1/100 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.00384779535946657028 5.08015220464053342972\n",
"0011 3.01092359285407942548 7.00986629035043250660 11.00714096900690120908 14.54539479507204734451\n",
"0021 3.01126701888801939808 7.00940415395213638997 11.00836318939147776855 15.00768242807840891379\n",
"0031 3.01127587179874177132 7.00940010741208102614 11.00836707199521305316 15.00767589992755745923\n",
"0041 3.01127600924765912057 7.00940007219598665485 11.00836708976921571663 15.00767588542487884709\n",
"0051 3.01127601051767600121 7.00940007197880818127 11.00836708984017669612 15.00767588538866738710\n",
"\u001b[91m\u001b[1m============================== λ = 1/1000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.00038463177350566723 5.08001536822649433277\n",
"0011 3.00109268123541446258 7.00098707227962478764 11.00071418567912101977 14.52715118238687657528\n",
"0021 3.00112738799267354533 7.00094069641398559268 11.00083647229263241051 15.00076834534023866698\n",
"0031 3.00112828715843954312 7.00094028867356488010 11.00083686220170092492 15.00076769106287425914\n",
"0041 3.00112830115381665040 7.00094028511705981986 11.00083686399053098592 15.00076768960623524517\n",
"0051 3.00112830128334179054 7.00094028509509442884 11.00083686399768276755 15.00076768960259319204\n",
"\u001b[91m\u001b[1m============================== λ = 1/10000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.00003846170232425611 5.08000153829767574389\n",
"0011 3.00010927133508974270 7.00009871164875566760 11.00007141947326702821 14.52539804171674108072\n",
"0021 3.00011274566632506694 7.00009407245161974920 11.00008364876232973279 15.00007683555872210033\n",
"0031 3.00011283572269044101 7.00009403164669077409 11.00008368776967075907 15.00007677011648026897\n",
"0041 3.00011283712475588042 7.00009403129069032084 11.00008368794866805383 15.00007676997075279990\n",
"0051 3.00011283713773388469 7.00009403128849129635 11.00008368794938378960 15.00007676997038838559\n",
"\u001b[91m\u001b[1m============================== λ = 1/100000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.00000384615548475484 5.08000015384451524516\n",
"0011 3.00001092716561649380 7.00000987120907177615 11.00000714195639784366 14.52522338338387495835\n",
"0021 3.00001127463530910316 7.00000940727326421751 11.00000836489156316913 15.00000768356611856568\n",
"0031 3.00001128364234457478 7.00000940319246242879 11.00000836879246156034 15.00000767702174944640\n",
"0041 3.00001128378257641902 7.00000940315685888300 11.00000836881036243269 15.00000767700717606396\n",
"0051 3.00001128378387447460 7.00000940315663895569 11.00000836881043401184 15.00000767700713962044\n",
"\u001b[91m\u001b[1m============================== λ = 1/1000000 ==============================\u001b[0m\n",
"------------------------------ γ = 0 ------------------------------\n",
"0001 3.00000038461540100137 5.08000001538459899863\n",
"0011 3.00000109271688271661 7.00000098712134912798 11.00000071419573051337 14.52520592405701742266\n",
"0021 3.00000112746421768230 7.00000094072760744421 11.00000083648930961840 15.00000076835671431950\n",
"0031 3.00000112836493521985 7.00000094031952417640 11.00000083687940110036 15.00000076770227595833\n",
"0041 3.00000112837895865730 7.00000094031596378682 11.00000083688119119902 15.00000076770081861373\n",
"0051 3.00000112837908846541 7.00000094031594179384 11.00000083688119835699 15.00000076770081496935\n"
]
}
],
"source": [
"for nλ in [o* 1000/10**gi for gi in range(10)]:\n",
" print('\\033[91m\\033[1m{linea} λ ={fnλ:>11s} {linea}\\033[0m'.format(linea = '='*30, fnλ = str(nλ)))\n",
" for nγ in [o* gi for gi in range(1)]:\n",
" print('{linea} γ ={fnγ:>2s} {linea}'.format(linea = '-'*30, fnγ = str(nγ)))\n",
" \n",
" # parameters of lambda_0 (pl0) and s_0 (ps0)\n",
" pl0 = {λ: nλ, γ:nγ}\n",
" ps0 = {λ: nλ, γ:nγ, α:nα}\n",
" \n",
" # pass lambda_0, s_0 and variable values to aim class\n",
" singular = aim(l0, s0, pl0, ps0)\n",
" #singular.display_parameters()\n",
" #singular.display_l0s0(0)\n",
" singular.parameters(En, r, nr0, nmax=51, nstep=10, dprec=500, tol=1e-101)\n",
" \n",
" # create coefficients for improved AIM\n",
" singular.c0()\n",
" singular.d0()\n",
" singular.cndn()\n",
" \n",
" \n",
" singular.get_arb_roots(showRoots='+r', printFormat=\"{:25.20f}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Eigenvalues and Eigenfucntions for $\\alpha = 4, \\gamma = 5, \\lambda = 100$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-27T20:18:50.878659Z",
"start_time": "2020-12-27T20:18:38.985945Z"
}
},
"outputs": [],
"source": [
"!pip3 install scipy"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-27T20:18:58.841460Z",
"start_time": "2020-12-27T20:18:57.879190Z"
}
},
"outputs": [],
"source": [
"from scipy.integrate import odeint \n",
"# https://perso.crans.org/besson/publis/notebooks/Runge-Kutta_methods_for_ODE_integration_in_Python.html\n",
"\n",
"%matplotlib notebook \n",
"import scipy.optimize as so\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib import cm\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-27T20:19:00.475227Z",
"start_time": "2020-12-27T20:19:00.462427Z"
}
},
"outputs": [],
"source": [
"V = lambda r, α, β, γ, λ: r**β + γ*(γ+1)/r**2 + λ/r**α\n",
"\n",
"# potential parameters\n",
"αβγλ = 4, 2, 5, 100\n",
"\n",
"# Energy Eigenvalues\n",
"Estop = 34\n",
"Espectrum = [15.54392598171621432978,\n",
" 19.92653800987177727185,\n",
" 24.26619272363845153429,\n",
" 28.57312197406556227733,\n",
" Estop]\n",
"\n",
"# Draw a line for each eigenvalue\n",
"EigenLine = []\n",
"for Ei in Espectrum:\n",
" Vr = lambda x: V(x, *αβγλ) - Ei\n",
" rL, rR = so.newton(Vr, 1e-1), so.newton(Vr, 6)\n",
" EigenLine += [[[rL, rR], [Ei, Ei]]]\n",
" \n",
"# create colors for the lines\n",
"Eimin = .7 * Espectrum[0]/Espectrum[-1]\n",
"Eimax = .7\n",
"cm_subsection = np.linspace(Eimin, Eimax, len(Espectrum)) \n",
"colors = [ cm.hot_r(x) for x in cm_subsection ]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2020-12-27T20:19:32.143224Z",
"start_time": "2020-12-27T20:19:32.050541Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
"\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
" } else if (typeof(MozWebSocket) !== 'undefined') {\n",
" return MozWebSocket;\n",
" } else {\n",
" alert('Your browser does not have WebSocket support. ' +\n",
" 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
" 'Firefox 4 and 5 are also supported but you ' +\n",
" 'have to enable WebSockets in about:config.');\n",
" };\n",
"}\n",
"\n",
"mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
" this.id = figure_id;\n",
"\n",
" this.ws = websocket;\n",
"\n",
" this.supports_binary = (this.ws.binaryType != undefined);\n",
"\n",
" if (!this.supports_binary) {\n",
" var warnings = document.getElementById(\"mpl-warnings\");\n",
" if (warnings) {\n",
" warnings.style.display = 'block';\n",
" warnings.textContent = (\n",
" \"This browser does not support binary websocket messages. \" +\n",
" \"Performance may be slow.\");\n",
" }\n",
" }\n",
"\n",
" this.imageObj = new Image();\n",
"\n",
" this.context = undefined;\n",
" this.message = undefined;\n",
" this.canvas = undefined;\n",
" this.rubberband_canvas = undefined;\n",
" this.rubberband_context = undefined;\n",
" this.format_dropdown = undefined;\n",
"\n",
" this.image_mode = 'full';\n",
"\n",
" this.root = $('');\n",
" this._root_extra_style(this.root)\n",
" this.root.attr('style', 'display: inline-block');\n",
"\n",
" $(parent_element).append(this.root);\n",
"\n",
" this._init_header(this);\n",
" this._init_canvas(this);\n",
" this._init_toolbar(this);\n",
"\n",
" var fig = this;\n",
"\n",
" this.waiting = false;\n",
"\n",
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
" if (mpl.ratio != 1) {\n",
" fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
" }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
" this.imageObj.onload = function() {\n",
" if (fig.image_mode == 'full') {\n",
" // Full images could contain transparency (where diff images\n",
" // almost always do), so we need to clear the canvas so that\n",
" // there is no ghosting.\n",
" fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
" }\n",
" fig.context.drawImage(fig.imageObj, 0, 0);\n",
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
" fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
"\n",
" this.ondownload = ondownload;\n",
"}\n",
"\n",
"mpl.figure.prototype._init_header = function() {\n",
" var titlebar = $(\n",
" '');\n",
" var titletext = $(\n",
" '');\n",
" titlebar.append(titletext)\n",
" this.root.append(titlebar);\n",
" this.header = titletext[0];\n",
"}\n",
"\n",
"\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._init_canvas = function() {\n",
" var fig = this;\n",
"\n",
" var canvas_div = $('');\n",
"\n",
" canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
"\n",
" function canvas_keyboard_event(event) {\n",
" return fig.key_event(event, event['data']);\n",
" }\n",
"\n",
" canvas_div.keydown('key_press', canvas_keyboard_event);\n",
" canvas_div.keyup('key_release', canvas_keyboard_event);\n",
" this.canvas_div = canvas_div\n",
" this._canvas_extra_style(canvas_div)\n",
" this.root.append(canvas_div);\n",
"\n",
" var canvas = $('');\n",
" canvas.addClass('mpl-canvas');\n",
" canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
"\n",
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
" var backingStore = this.context.backingStorePixelRatio ||\n",
"\tthis.context.webkitBackingStorePixelRatio ||\n",
"\tthis.context.mozBackingStorePixelRatio ||\n",
"\tthis.context.msBackingStorePixelRatio ||\n",
"\tthis.context.oBackingStorePixelRatio ||\n",
"\tthis.context.backingStorePixelRatio || 1;\n",
"\n",
" mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
"\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
" var pass_mouse_events = true;\n",
"\n",
" canvas_div.resizable({\n",
" start: function(event, ui) {\n",
" pass_mouse_events = false;\n",
" },\n",
" resize: function(event, ui) {\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" stop: function(event, ui) {\n",
" pass_mouse_events = true;\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" });\n",
"\n",
" function mouse_event_fn(event) {\n",
" if (pass_mouse_events)\n",
" return fig.mouse_event(event, event['data']);\n",
" }\n",
"\n",
" rubberband.mousedown('button_press', mouse_event_fn);\n",
" rubberband.mouseup('button_release', mouse_event_fn);\n",
" // Throttle sequential mouse events to 1 every 20ms.\n",
" rubberband.mousemove('motion_notify', mouse_event_fn);\n",
"\n",
" rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
" rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
"\n",
" canvas_div.on(\"wheel\", function (event) {\n",
" event = event.originalEvent;\n",
" event['data'] = 'scroll'\n",
" if (event.deltaY < 0) {\n",
" event.step = 1;\n",
" } else {\n",
" event.step = -1;\n",
" }\n",
" mouse_event_fn(event);\n",
" });\n",
"\n",
" canvas_div.append(canvas);\n",
" canvas_div.append(rubberband);\n",
"\n",
" this.rubberband = rubberband;\n",
" this.rubberband_canvas = rubberband[0];\n",
" this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
" this.rubberband_context.strokeStyle = \"#000000\";\n",
"\n",
" this._resize_canvas = function(width, height) {\n",
" // Keep the size of the canvas, canvas container, and rubber band\n",
" // canvas in synch.\n",
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
" canvas.attr('width', width * mpl.ratio);\n",
" canvas.attr('height', height * mpl.ratio);\n",
" canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
" }\n",
"\n",
" // Set the figure to an initial 600x600px, this will subsequently be updated\n",
" // upon first draw.\n",
" this._resize_canvas(600, 600);\n",
"\n",
" // Disable right mouse context menu.\n",
" $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
" return false;\n",
" });\n",
"\n",
" function set_focus () {\n",
" canvas.focus();\n",
" canvas_div.focus();\n",
" }\n",
"\n",
" window.setTimeout(set_focus, 100);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('');\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items) {\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) {\n",
" // put a spacer in here.\n",
" continue;\n",
" }\n",
" var button = $('');\n",
" button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
" 'ui-button-icon-only');\n",
" button.attr('role', 'button');\n",
" button.attr('aria-disabled', 'false');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
"\n",
" var icon_img = $('');\n",
" icon_img.addClass('ui-button-icon-primary ui-icon');\n",
" icon_img.addClass(image);\n",
" icon_img.addClass('ui-corner-all');\n",
"\n",
" var tooltip_span = $('');\n",
" tooltip_span.addClass('ui-button-text');\n",
" tooltip_span.html(tooltip);\n",
"\n",
" button.append(icon_img);\n",
" button.append(tooltip_span);\n",
"\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" var fmt_picker_span = $('');\n",
"\n",
" var fmt_picker = $('');\n",
" fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
" fmt_picker_span.append(fmt_picker);\n",
" nav_element.append(fmt_picker_span);\n",
" this.format_dropdown = fmt_picker[0];\n",
"\n",
" for (var ind in mpl.extensions) {\n",
" var fmt = mpl.extensions[ind];\n",
" var option = $(\n",
" '', {selected: fmt === mpl.default_extension}).html(fmt);\n",
" fmt_picker.append(option);\n",
" }\n",
"\n",
" // Add hover states to the ui-buttons\n",
" $( \".ui-button\" ).hover(\n",
" function() { $(this).addClass(\"ui-state-hover\");},\n",
" function() { $(this).removeClass(\"ui-state-hover\");}\n",
" );\n",
"\n",
" var status_bar = $('');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"}\n",
"\n",
"mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
" // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
" // which will in turn request a refresh of the image.\n",
" this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
"}\n",
"\n",
"mpl.figure.prototype.send_message = function(type, properties) {\n",
" properties['type'] = type;\n",
" properties['figure_id'] = this.id;\n",
" this.ws.send(JSON.stringify(properties));\n",
"}\n",
"\n",
"mpl.figure.prototype.send_draw_message = function() {\n",
" if (!this.waiting) {\n",
" this.waiting = true;\n",
" this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
" }\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" var format_dropdown = fig.format_dropdown;\n",
" var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
" fig.ondownload(fig, format);\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
" var size = msg['size'];\n",
" if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
" fig._resize_canvas(size[0], size[1]);\n",
" fig.send_message(\"refresh\", {});\n",
" };\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
" var x0 = msg['x0'] / mpl.ratio;\n",
" var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
" var x1 = msg['x1'] / mpl.ratio;\n",
" var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
" y1 = Math.floor(y1) + 0.5;\n",
" var min_x = Math.min(x0, x1);\n",
" var min_y = Math.min(y0, y1);\n",
" var width = Math.abs(x1 - x0);\n",
" var height = Math.abs(y1 - y0);\n",
"\n",
" fig.rubberband_context.clearRect(\n",
" 0, 0, fig.canvas.width / mpl.ratio, fig.canvas.height / mpl.ratio);\n",
"\n",
" fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
" // Updates the figure title.\n",
" fig.header.textContent = msg['label'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
" var cursor = msg['cursor'];\n",
" switch(cursor)\n",
" {\n",
" case 0:\n",
" cursor = 'pointer';\n",
" break;\n",
" case 1:\n",
" cursor = 'default';\n",
" break;\n",
" case 2:\n",
" cursor = 'crosshair';\n",
" break;\n",
" case 3:\n",
" cursor = 'move';\n",
" break;\n",
" }\n",
" fig.rubberband_canvas.style.cursor = cursor;\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_message = function(fig, msg) {\n",
" fig.message.textContent = msg['message'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
" // Request the server to send over a new figure.\n",
" fig.send_draw_message();\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
" fig.image_mode = msg['mode'];\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Called whenever the canvas gets updated.\n",
" this.send_message(\"ack\", {});\n",
"}\n",
"\n",
"// A function to construct a web socket function for onmessage handling.\n",
"// Called in the figure constructor.\n",
"mpl.figure.prototype._make_on_message_function = function(fig) {\n",
" return function socket_on_message(evt) {\n",
" if (evt.data instanceof Blob) {\n",
" /* FIXME: We get \"Resource interpreted as Image but\n",
" * transferred with MIME type text/plain:\" errors on\n",
" * Chrome. But how to set the MIME type? It doesn't seem\n",
" * to be part of the websocket stream */\n",
" evt.data.type = \"image/png\";\n",
"\n",
" /* Free the memory for the previous frames */\n",
" if (fig.imageObj.src) {\n",
" (window.URL || window.webkitURL).revokeObjectURL(\n",
" fig.imageObj.src);\n",
" }\n",
"\n",
" fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
" evt.data);\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
" else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
" fig.imageObj.src = evt.data;\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
"\n",
" var msg = JSON.parse(evt.data);\n",
" var msg_type = msg['type'];\n",
"\n",
" // Call the \"handle_{type}\" callback, which takes\n",
" // the figure and JSON message as its only arguments.\n",
" try {\n",
" var callback = fig[\"handle_\" + msg_type];\n",
" } catch (e) {\n",
" console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
" return;\n",
" }\n",
"\n",
" if (callback) {\n",
" try {\n",
" // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
" callback(fig, msg);\n",
" } catch (e) {\n",
" console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
" }\n",
" }\n",
" };\n",
"}\n",
"\n",
"// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
"mpl.findpos = function(e) {\n",
" //this section is from http://www.quirksmode.org/js/events_properties.html\n",
" var targ;\n",
" if (!e)\n",
" e = window.event;\n",
" if (e.target)\n",
" targ = e.target;\n",
" else if (e.srcElement)\n",
" targ = e.srcElement;\n",
" if (targ.nodeType == 3) // defeat Safari bug\n",
" targ = targ.parentNode;\n",
"\n",
" // jQuery normalizes the pageX and pageY\n",
" // pageX,Y are the mouse positions relative to the document\n",
" // offset() returns the position of the element relative to the document\n",
" var x = e.pageX - $(targ).offset().left;\n",
" var y = e.pageY - $(targ).offset().top;\n",
"\n",
" return {\"x\": x, \"y\": y};\n",
"};\n",
"\n",
"/*\n",
" * return a copy of an object with only non-object keys\n",
" * we need this to avoid circular references\n",
" * http://stackoverflow.com/a/24161582/3208463\n",
" */\n",
"function simpleKeys (original) {\n",
" return Object.keys(original).reduce(function (obj, key) {\n",
" if (typeof original[key] !== 'object')\n",
" obj[key] = original[key]\n",
" return obj;\n",
" }, {});\n",
"}\n",
"\n",
"mpl.figure.prototype.mouse_event = function(event, name) {\n",
" var canvas_pos = mpl.findpos(event)\n",
"\n",
" if (name === 'button_press')\n",
" {\n",
" this.canvas.focus();\n",
" this.canvas_div.focus();\n",
" }\n",
"\n",
" var x = canvas_pos.x * mpl.ratio;\n",
" var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
" guiEvent: simpleKeys(event)});\n",
"\n",
" /* This prevents the web browser from automatically changing to\n",
" * the text insertion cursor when the button is pressed. We want\n",
" * to control all of the cursor setting manually through the\n",
" * 'cursor' event from matplotlib */\n",
" event.preventDefault();\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" // Handle any extra behaviour associated with a key event\n",
"}\n",
"\n",
"mpl.figure.prototype.key_event = function(event, name) {\n",
"\n",
" // Prevent repeat events\n",
" if (name == 'key_press')\n",
" {\n",
" if (event.which === this._key)\n",
" return;\n",
" else\n",
" this._key = event.which;\n",
" }\n",
" if (name == 'key_release')\n",
" this._key = null;\n",
"\n",
" var value = '';\n",
" if (event.ctrlKey && event.which != 17)\n",
" value += \"ctrl+\";\n",
" if (event.altKey && event.which != 18)\n",
" value += \"alt+\";\n",
" if (event.shiftKey && event.which != 16)\n",
" value += \"shift+\";\n",
"\n",
" value += 'k';\n",
" value += event.which.toString();\n",
"\n",
" this._key_event_extra(event, name);\n",
"\n",
" this.send_message(name, {key: value,\n",
" guiEvent: simpleKeys(event)});\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
" if (name == 'download') {\n",
" this.handle_save(this, null);\n",
" } else {\n",
" this.send_message(\"toolbar_button\", {name: name});\n",
" }\n",
"};\n",
"\n",
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
"mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
"mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
" // object with the appropriate methods. Currently this is a non binary\n",
" // socket, so there is still some room for performance tuning.\n",
" var ws = {};\n",
"\n",
" ws.close = function() {\n",
" comm.close()\n",
" };\n",
" ws.send = function(m) {\n",
" //console.log('sending', m);\n",
" comm.send(m);\n",
" };\n",
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
" // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
"}\n",
"\n",
"mpl.mpl_figure_comm = function(comm, msg) {\n",
" // This is the function which gets called when the mpl process\n",
" // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
"\n",
" var id = msg.content.data.id;\n",
" // Get hold of the div created by the display call when the Comm\n",
" // socket was opened in Python.\n",
" var element = $(\"#\" + id);\n",
" var ws_proxy = comm_websocket_adapter(comm)\n",
"\n",
" function ondownload(figure, format) {\n",
" window.open(figure.imageObj.src);\n",
" }\n",
"\n",
" var fig = new mpl.figure(id, ws_proxy,\n",
" ondownload,\n",
" element.get(0));\n",
"\n",
" // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
" // web socket which is closed, not our websocket->open comm proxy.\n",
" ws_proxy.onopen();\n",
"\n",
" fig.parent_element = element.get(0);\n",
" fig.cell_info = mpl.find_output_cell(\"\");\n",
" if (!fig.cell_info) {\n",
" console.error(\"Failed to find cell for figure\", id, fig);\n",
" return;\n",
" }\n",
"\n",
" var output_index = fig.cell_info[2]\n",
" var cell = fig.cell_info[0];\n",
"\n",
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
" var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
" fig.push_to_output();\n",
" var dataURL = fig.canvas.toDataURL();\n",
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
" $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
"mpl.figure.prototype.close_ws = function(fig, msg){\n",
" fig.send_message('closing', msg);\n",
" // fig.ws.close()\n",
"}\n",
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
" var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
" this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Tell IPython that the notebook contents must change.\n",
" IPython.notebook.set_dirty(true);\n",
" this.send_message(\"ack\", {});\n",
" var fig = this;\n",
" // Wait a second, then push the new image to the DOM so\n",
" // that it is saved nicely (might be nice to debounce this).\n",
" setTimeout(function () { fig.push_to_output() }, 1000);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('');\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items){\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) { continue; };\n",
"\n",
" var button = $('');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" // Add the status bar.\n",
" var status_bar = $('');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"\n",
" // Add the close button to the window.\n",
" var buttongrp = $('');\n",
" var button = $('');\n",
" button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
" button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
" buttongrp.append(button);\n",
" var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
" titlebar.prepend(buttongrp);\n",
"}\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(el){\n",
" var fig = this\n",
" el.on(\"remove\", function(){\n",
"\tfig.close_ws(fig, {});\n",
" });\n",
"}\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(el){\n",
" // this is important to make the div 'focusable\n",
" el.attr('tabindex', 0)\n",
" // reach out to IPython and tell the keyboard manager to turn it's self\n",
" // off when our div gets focus\n",
"\n",
" // location in version 3\n",
" if (IPython.notebook.keyboard_manager) {\n",
" IPython.notebook.keyboard_manager.register_events(el);\n",
" }\n",
" else {\n",
" // location in version 2\n",
" IPython.keyboard_manager.register_events(el);\n",
" }\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" var manager = IPython.notebook.keyboard_manager;\n",
" if (!manager)\n",
" manager = IPython.keyboard_manager;\n",
"\n",
" // Check for shift+enter\n",
" if (event.shiftKey && event.which == 13) {\n",
" this.canvas_div.blur();\n",
" // select the cell after this one\n",
" var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n",
" IPython.notebook.select(index + 1);\n",
" }\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" fig.ondownload(fig, null);\n",
"}\n",
"\n",
"\n",
"mpl.find_output_cell = function(html_output) {\n",
" // Return the cell and output element which can be found *uniquely* in the notebook.\n",
" // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
" // IPython event is triggered only after the cells have been serialised, which for\n",
" // our purposes (turning an active figure into a static one), is too late.\n",
" var cells = IPython.notebook.get_cells();\n",
" var ncells = cells.length;\n",
" for (var i=0; i= 3 moved mimebundle to data attribute of output\n",
" data = data.data;\n",
" }\n",
" if (data['text/html'] == html_output) {\n",
" return [cell, data, j];\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"\n",
"// Register the function which deals with the matplotlib target/channel.\n",
"// The kernel may be null if the page has been refreshed.\n",
"if (IPython.notebook.kernel != null) {\n",
" IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
"}\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Scale = 4.5\n",
"plt.figure(figsize=(Scale, Scale*1.618))\n",
"for i, Ei in enumerate(EigenLine[:-1]):\n",
" plt.axhline(Espectrum[i], color=colors[i], linestyle=':')\n",
" plt.plot(*Ei, color=colors[i])\n",
" \n",
" \n",
"for i, Ei in enumerate(Espectrum[0:-1]):\n",
" def pend(y, t):\n",
" return np.array([y[1], -(Ei - V(t, *αβγλ))*y[0]])\n",
" \n",
" y0L = 1e-1, 1e-1\n",
" y0R = (-1)**i * 1e-1, (-1)**i * 1e-1\n",
" \n",
" rL, rR = EigenLine[i][0]\n",
" rM = (rL + rR)/2\n",
" tL = np.linspace(1e-1, rM, 101)\n",
" tR = np.linspace(9, rM, 101)\n",
" \n",
" solL = odeint(pend, y0L, tL)\n",
" solR = odeint(pend, y0R, tR)\n",
" \n",
" WL = solL[:, 0]/abs(solL[:, 0][-1])\n",
" WR = solR[:, 0]/abs(solR[:, 0][-1])\n",
" Wmax = max(max(abs(WL)), max(abs(WR)))\n",
" \n",
" plt.plot(tL, Ei + 1.6*WL/Wmax, color=colors[i])\n",
" plt.plot(tR, Ei + 1.6*WR/Wmax, color=colors[i])\n",
" \n",
"rs = np.linspace(*EigenLine[-1][0], 500) \n",
"plt.plot(rs, V(rs, *αβγλ), color='blue')\n",
"plt.xlabel('r [arbitrary]', fontsize=14)\n",
"plt.ylabel('$\\psi(r)$, V(r), E [all arbitrary]', fontsize=14)\n",
"#plt.grid(color='lightgray')\n",
"plt.grid(axis='x', linestyle='--', color='lightgray')\n",
"#plt.grid(linestyle='--', color='lightgray')\n",
"plt.xlim(EigenLine[-1][0])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
},
"toc": {
"base_numbering": 1,
"nav_menu": {
"height": "12px",
"width": "252px"
},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "İçindekiler",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {
"height": "785px",
"left": "0px",
"right": "1708px",
"top": "158px",
"width": "370px"
},
"toc_section_display": "block",
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 1
}