Skip to content

Instantly share code, notes, and snippets.

@pageman
Created February 24, 2025 16:15
Show Gist options
  • Save pageman/13f93d489d106f4b34cb8013ebfab795 to your computer and use it in GitHub Desktop.
Save pageman/13f93d489d106f4b34cb8013ebfab795 to your computer and use it in GitHub Desktop.
LieE80.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyOdSIOoI02jNKfsjxyKmvwa",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/pageman/13f93d489d106f4b34cb8013ebfab795/liee80.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 596
},
"id": "AZUK9w9duYIs",
"outputId": "eb4b7f6b-dfe3-41ba-dd7c-ee016c57c2a0"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Requirement already satisfied: plotly in /usr/local/lib/python3.11/dist-packages (5.24.1)\n",
"Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.11/dist-packages (from plotly) (9.0.0)\n",
"Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from plotly) (24.2)\n"
]
},
{
"output_type": "display_data",
"data": {
"text/html": [
"<html>\n",
"<head><meta charset=\"utf-8\" /></head>\n",
"<body>\n",
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
" <script charset=\"utf-8\" src=\"https://cdn.plot.ly/plotly-2.35.2.min.js\"></script> <div id=\"d8ec61ec-f440-473c-868f-1d8801084abc\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"d8ec61ec-f440-473c-868f-1d8801084abc\")) { Plotly.newPlot( \"d8ec61ec-f440-473c-868f-1d8801084abc\", [{\"marker\":{\"color\":[4.821406624345942,3.868730652209379,6.829909047211927,3.00047559072918,6.383128855445838,5.489321902712711,4.492695524494106,4.531599096889441,4.169243115876133,1.422063924791493,3.669152630664285,2.227766395283294,2.675209270351313,4.48044203946099,2.5555491888639925,3.8780453176967002,6.858412714999156,3.2717962920642494,6.912659799075352,5.088406983554705,2.193620877132954,2.0823896919362257,4.053716432717777,1.9920263820749062,5.551041517760168,4.635474193015085,7.414354198352148,6.144880556134113,2.445684323341662,3.975098170985722,2.767220635195585,2.6383766567960607,6.430152561620378,3.5000983116443574,5.263335731536637,3.893917374917459,6.411510446265524,7.069986552062076,6.360250014335128,5.935093314582813,1.5396990631288072,1.5482576124435563,3.775437607709896,2.068293552231519,4.651914539776911,6.220718830077598,2.9875152967755234,4.193046428912968,4.673465536238078,2.911093711234268,6.780198624736471,3.8758419523970544,4.085402867323376,3.574171068432323,2.93979642357668,1.976246889009375,4.818234832508329,3.814567579663231,5.639803817703483,4.268456470687129,1.4574626995787905,3.154977845339712,1.4921132844949077,4.175005048485624,4.175005048485624,1.4921132844949077,3.154977845339712,1.4574626995787905,4.268456470687129,5.639803817703483,3.814567579663231,4.818234832508329,1.976246889009375,2.93979642357668,3.574171068432323,4.085402867323376,3.8758419523970544,6.780198624736471,2.911093711234268,4.673465536238078,4.193046428912968,2.9875152967755234,6.220718830077598,4.651914539776911,2.068293552231519,3.775437607709896,1.5482576124435563,1.5396990631288072,5.935093314582813,6.360250014335128,7.069986552062076,6.411510446265524,3.893917374917459,5.263335731536637,3.5000983116443574,6.430152561620378,2.6383766567960607,2.767220635195585,3.975098170985722,2.445684323341662,6.144880556134113,7.414354198352148,4.635474193015085,5.551041517760168,1.9920263820749062,4.053716432717777,2.0823896919362257,2.193620877132954,5.088406983554705,6.912659799075352,3.2717962920642494,6.858412714999156,3.8780453176967002,2.5555491888639925,4.48044203946099,2.675209270351313,2.227766395283294,3.669152630664285,1.422063924791493,4.169243115876133,4.531599096889441,4.492695524494106,5.489321902712711,6.383128855445838,3.00047559072918,6.829909047211927,3.868730652209379,4.821406624345942,2.556124086922851,2.556124086922851,1.5323199150108386,1.5323199150108386,3.895211159916202,3.895211159916202,3.625350608884147,3.625350608884147,4.753108109956561,4.753108109956561,1.5664664998090978,1.5664664998090978,3.0265922994132763,3.0265922994132763,2.718728499013305,2.718728499013305],\"colorscale\":[[0.0,\"#440154\"],[0.1111111111111111,\"#482878\"],[0.2222222222222222,\"#3e4989\"],[0.3333333333333333,\"#31688e\"],[0.4444444444444444,\"#26828e\"],[0.5555555555555556,\"#1f9e89\"],[0.6666666666666666,\"#35b779\"],[0.7777777777777778,\"#6ece58\"],[0.8888888888888888,\"#b5de2b\"],[1.0,\"#fde725\"]],\"opacity\":0.8,\"size\":3},\"mode\":\"markers\",\"x\":[-2.257869907273878,-0.5868849257079799,-1.2119039622227081,-2.420295814235644,-1.2359086804939716,-2.444300532506908,-3.069319569021636,-1.3983345874557376,1.2972403674273396,0.08884851541440353,-0.5361705211003246,1.1348144604655737,-0.5601752393715883,1.1108097421943102,0.48579070567958194,-0.7226011463333543,0.38523173397433286,-0.8231601180386033,-1.4481791545533316,0.2228058270125669,-1.472183872824595,0.1988011087413032,-0.42621792777342493,-1.634609779786361,1.0609651750967166,2.7319501566626148,2.1069311201478866,0.8985392681349506,2.0829264018766227,0.8745345498636866,0.2495155133489585,1.9205004949148567,-1.569577527175805,-2.7779693791887414,-3.4029884157034695,-1.732003434137571,-3.426993133974733,-1.7560081524088345,-2.3810271889235626,-3.589419040936499,-0.8938440860534216,0.7771408955124768,0.15212185899774866,-1.0562699930151875,0.12811714072648495,-1.0802747112864513,-1.7052937478011794,-0.03430876623528101,-1.805852719506428,-0.13486773794052975,-0.7598867744552579,-1.968278626468194,-0.7838914927265218,-1.992283344739458,-2.617302381254186,-0.9463173996882878,1.7492575551947898,0.5408657031818535,-0.08415333333287467,1.5868316482330238,-0.10815805160413838,1.5628269299617599,0.9378078934470319,-0.27058395856590434,0.27058395856590434,-0.9378078934470319,-1.5628269299617599,0.10815805160413838,-1.5868316482330238,0.08415333333287467,-0.5408657031818535,-1.7492575551947898,0.9463173996882878,2.617302381254186,1.992283344739458,0.7838914927265218,1.968278626468194,0.7598867744552579,0.13486773794052975,1.805852719506428,0.03430876623528101,1.7052937478011794,1.0802747112864513,-0.12811714072648495,1.0562699930151875,-0.15212185899774866,-0.7771408955124768,0.8938440860534216,3.589419040936499,2.3810271889235626,1.7560081524088345,3.426993133974733,1.732003434137571,3.4029884157034695,2.7779693791887414,1.569577527175805,-1.9205004949148567,-0.2495155133489585,-0.8745345498636866,-2.0829264018766227,-0.8985392681349506,-2.1069311201478866,-2.7319501566626148,-1.0609651750967166,1.634609779786361,0.42621792777342493,-0.1988011087413032,1.472183872824595,-0.2228058270125669,1.4481791545533316,0.8231601180386033,-0.38523173397433286,0.7226011463333543,-0.48579070567958194,-1.1108097421943102,0.5601752393715883,-1.1348144604655737,0.5361705211003246,-0.08884851541440353,-1.2972403674273396,1.3983345874557376,3.069319569021636,2.444300532506908,1.2359086804939716,2.420295814235644,1.2119039622227081,0.5868849257079799,2.257869907273878,1.0887654490503653,-1.0887654490503653,-0.7513960366913439,0.7513960366913439,1.2034132244587938,-1.2034132244587938,2.1154218579118007,-2.1154218579118007,-0.4177271900095108,0.4177271900095108,-0.39372247173824704,0.39372247173824704,0.23129656477648106,-0.23129656477648106,1.4396884167894173,-1.4396884167894173],\"y\":[0.20216098596974635,1.7256459190678988,-0.3534946321014995,-0.672564782842497,5.042778775648873,4.723708624907875,2.6445680737384767,4.1680530068366295,-0.5216512963170568,-0.8407214470580542,-2.9198619982274523,-1.3963770651293,2.4764114095229197,3.999896342621072,1.9207557914516735,1.6016856407106763,-2.581117841128554,-2.9001879918695512,-4.9793285430389504,-3.4558436099407976,0.4169448647114224,1.9404297978095748,-0.13871075335982347,-0.45778090410082095,-5.147485207254507,-3.6240002741563546,-5.703140825325753,-6.022210976066751,-0.3068674175753809,-0.6259375683163784,-2.7050781194857767,-1.1815931863876243,2.3247159077269317,2.0056457569859343,-0.07349479418346416,1.4499901389146883,5.322778613566908,6.846263546665061,4.767122995495662,4.448052844754664,-0.24165145839902158,1.281833474699131,-0.7973070764702674,-1.1163772272112649,4.5989663312801055,4.279896180539107,2.200755629369709,3.724240562467861,-2.301118003210519,-0.7776330701123666,-2.8567736212817647,-3.175843772022762,2.5394997864686073,2.22042963572761,0.14128908455821126,1.6647740176563637,-3.0249302854973217,-3.344000436238319,-5.423140987407718,-3.8996560543095655,-0.026867579657345986,1.4966173534408065,-0.5825231977285918,-0.9015933484695893,0.9015933484695893,0.5825231977285918,-1.4966173534408065,0.026867579657345986,3.8996560543095655,5.423140987407718,3.344000436238319,3.0249302854973217,-1.6647740176563637,-0.14128908455821126,-2.22042963572761,-2.5394997864686073,3.175843772022762,2.8567736212817647,0.7776330701123666,2.301118003210519,-3.724240562467861,-2.200755629369709,-4.279896180539107,-4.5989663312801055,1.1163772272112649,0.7973070764702674,-1.281833474699131,0.24165145839902158,-4.448052844754664,-4.767122995495662,-6.846263546665061,-5.322778613566908,-1.4499901389146883,0.07349479418346416,-2.0056457569859343,-2.3247159077269317,1.1815931863876243,2.7050781194857767,0.6259375683163784,0.3068674175753809,6.022210976066751,5.703140825325753,3.6240002741563546,5.147485207254507,0.45778090410082095,0.13871075335982347,-1.9404297978095748,-0.4169448647114224,3.4558436099407976,4.9793285430389504,2.9001879918695512,2.581117841128554,-1.6016856407106763,-1.9207557914516735,-3.999896342621072,-2.4764114095229197,1.3963770651293,2.9198619982274523,0.8407214470580542,0.5216512963170568,-4.1680530068366295,-2.6445680737384767,-4.723708624907875,-5.042778775648873,0.672564782842497,0.3534946321014995,-1.7256459190678988,-0.20216098596974635,-0.22184517941973217,0.22184517941973217,1.20127737983761,-1.20127737983761,-3.7045563690178756,3.7045563690178756,-1.645089824206378,1.645089824206378,3.919340247759551,-3.919340247759551,-1.4769331599908209,1.4769331599908209,0.6022073911785776,-0.6022073911785776,0.921277541919575,-0.921277541919575],\"z\":[-4.255245733781507,-3.412446205484484,-6.71222674859928,-1.6409383154265935,-3.713118088422478,1.3581703447502083,-1.9416101983645873,-1.098810670067564,-3.9278028862772945,1.1434855468953917,-2.156294996219404,-1.3134954679223805,0.842813663957398,1.6856131922544213,-1.6141673508603742,3.457121082312312,-6.342495736743471,-1.2712073035707845,-4.570987846685581,-3.7281883183885567,-1.5718791865087787,-0.7290796582117554,-4.028860201326551,1.0424282318461353,-1.7865639843635952,-0.9437644560665719,-4.243544999181367,0.8277434339913188,-1.2444363390045656,3.8268520941681206,0.5270715510533249,1.3698710793503484,-5.786102686632786,-0.7148142534600992,-4.014594796574896,-3.171795268277872,-1.015486136398093,-0.1726866081010695,-3.472467151215865,1.598821281956821,-1.2301709342529095,-0.38737140595588604,-3.6871519490706817,1.3841364841020045,-0.6880432888938799,4.383245144278806,1.0834646011640108,1.926264129461034,-3.6448637847190857,-2.8020642564220624,-6.101844799536858,-1.0305563663641721,-3.1027361393600565,1.9685522938126296,-1.3312282493021659,-0.4884287210051427,-3.317420937214873,1.753867495957813,-1.5459130471569824,-0.7031135188599591,1.4531956130198194,2.2959951413168427,-1.0037854017979528,4.067503031374733,-4.067503031374733,1.0037854017979528,-2.2959951413168427,-1.4531956130198194,0.7031135188599591,1.5459130471569824,-1.753867495957813,3.317420937214873,0.4884287210051427,1.3312282493021659,-1.9685522938126296,3.1027361393600565,1.0305563663641721,6.101844799536858,2.8020642564220624,3.6448637847190857,-1.926264129461034,-1.0834646011640108,-4.383245144278806,0.6880432888938799,-1.3841364841020045,3.6871519490706817,0.38737140595588604,1.2301709342529095,-1.598821281956821,3.472467151215865,0.1726866081010695,1.015486136398093,3.171795268277872,4.014594796574896,0.7148142534600992,5.786102686632786,-1.3698710793503484,-0.5270715510533249,-3.8268520941681206,1.2444363390045656,-0.8277434339913188,4.243544999181367,0.9437644560665719,1.7865639843635952,-1.0424282318461353,4.028860201326551,0.7290796582117554,1.5718791865087787,3.7281883183885567,4.570987846685581,1.2712073035707845,6.342495736743471,-3.457121082312312,1.6141673508603742,-1.6856131922544213,-0.842813663957398,1.3134954679223805,2.156294996219404,-1.1434855468953917,3.9278028862772945,1.098810670067564,1.9416101983645873,-1.3581703447502083,3.713118088422478,1.6409383154265935,6.71222674859928,3.412446205484484,4.255245733781507,2.3019871548446056,-2.3019871548446056,0.5833874995865536,-0.5833874995865536,0.026994449475867842,-0.026994449475867842,2.4416872999420445,-2.4416872999420445,2.656372097796861,-2.656372097796861,-0.342736562379941,0.342736562379941,2.9570439807348547,-2.9570439807348547,-2.1142444524378314,2.1142444524378314],\"type\":\"scatter3d\"}], {\"template\":{\"data\":{\"histogram2dcontour\":[{\"type\":\"histogram2dcontour\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"choropleth\":[{\"type\":\"choropleth\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}],\"histogram2d\":[{\"type\":\"histogram2d\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"heatmap\":[{\"type\":\"heatmap\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"heatmapgl\":[{\"type\":\"heatmapgl\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contourcarpet\":[{\"type\":\"contourcarpet\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}],\"contour\":[{\"type\":\"contour\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"surface\":[{\"type\":\"surface\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"mesh3d\":[{\"type\":\"mesh3d\",\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}],\"scatter\":[{\"fillpattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2},\"type\":\"scatter\"}],\"parcoords\":[{\"type\":\"parcoords\",\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"scatterpolargl\":[{\"type\":\"scatterpolargl\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"scattergeo\":[{\"type\":\"scattergeo\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"scatterpolar\":[{\"type\":\"scatterpolar\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"scattergl\":[{\"type\":\"scattergl\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"scatter3d\":[{\"type\":\"scatter3d\",\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"scattermapbox\":[{\"type\":\"scattermapbox\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"scatterternary\":[{\"type\":\"scatterternary\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"scattercarpet\":[{\"type\":\"scattercarpet\",\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}}}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}]},\"layout\":{\"autotypenumbers\":\"strict\",\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"hovermode\":\"closest\",\"hoverlabel\":{\"align\":\"left\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"bgcolor\":\"#E5ECF6\",\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"ternary\":{\"bgcolor\":\"#E5ECF6\",\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]]},\"xaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"automargin\":true,\"zerolinewidth\":2},\"yaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"automargin\":true,\"zerolinewidth\":2},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\",\"gridwidth\":2},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\",\"gridwidth\":2},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\",\"gridwidth\":2}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"geo\":{\"bgcolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"subunitcolor\":\"white\",\"showland\":true,\"showlakes\":true,\"lakecolor\":\"white\"},\"title\":{\"x\":0.05},\"mapbox\":{\"style\":\"light\"}}},\"margin\":{\"l\":0,\"r\":0,\"b\":0,\"t\":40},\"title\":{\"text\":\"Interactive 3D Visualization of E8 Root System\"},\"scene\":{\"xaxis\":{\"title\":{\"text\":\"X\"}},\"yaxis\":{\"title\":{\"text\":\"Y\"}},\"zaxis\":{\"title\":{\"text\":\"Z\"}}}}, {\"responsive\": true} ).then(function(){\n",
" \n",
"var gd = document.getElementById('d8ec61ec-f440-473c-868f-1d8801084abc');\n",
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; </script> </div>\n",
"</body>\n",
"</html>"
]
},
"metadata": {}
}
],
"source": [
"# Step 1: Install required libraries\n",
"!pip install plotly\n",
"\n",
"# Step 2: Import necessary libraries\n",
"import numpy as np\n",
"import plotly.graph_objects as go\n",
"\n",
"# Step 3: Generate the E8 root system\n",
"def generate_e8_roots():\n",
" roots = []\n",
" # Generate all permutations of ±1 with an even number of -1s\n",
" for i in range(2**8):\n",
" binary = [(-1)**int(x) for x in format(i, '08b')]\n",
" if sum(1 for x in binary if x == -1) % 2 == 0:\n",
" roots.append(binary)\n",
"\n",
" # Add permutations of ±2 with one non-zero entry\n",
" for i in range(8):\n",
" for sign in [-2, 2]:\n",
" root = [0] * 8\n",
" root[i] = sign\n",
" roots.append(root)\n",
"\n",
" return np.array(roots)\n",
"\n",
"# Step 4: Project 8D roots into 3D using a random projection matrix\n",
"def project_to_3d(roots):\n",
" projection_matrix = np.random.randn(8, 3)\n",
" projected_roots = np.dot(roots, projection_matrix)\n",
" return projected_roots\n",
"\n",
"# Step 5: Generate and project the E8 roots\n",
"e8_roots = generate_e8_roots()\n",
"projected_roots = project_to_3d(e8_roots)\n",
"\n",
"# Step 6: Create an interactive 3D plot using Plotly\n",
"fig = go.Figure(data=[go.Scatter3d(\n",
" x=projected_roots[:, 0],\n",
" y=projected_roots[:, 1],\n",
" z=projected_roots[:, 2],\n",
" mode='markers',\n",
" marker=dict(\n",
" size=3,\n",
" color=np.linalg.norm(projected_roots, axis=1), # Color by magnitude\n",
" colorscale='Viridis',\n",
" opacity=0.8\n",
" )\n",
")])\n",
"\n",
"# Update layout for better visualization\n",
"fig.update_layout(\n",
" title=\"Interactive 3D Visualization of E8 Root System\",\n",
" scene=dict(\n",
" xaxis_title='X',\n",
" yaxis_title='Y',\n",
" zaxis_title='Z'\n",
" ),\n",
" margin=dict(l=0, r=0, b=0, t=40)\n",
")\n",
"\n",
"# Step 7: Show the figure\n",
"fig.show()"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment