【深耕 Python】Quantum Computing 量子计算机(6)计算<m|V|n>数值积分

本文主要是介绍【深耕 Python】Quantum Computing 量子计算机(6)计算<m|V|n>数值积分,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

写在前面

往期量子计算机博客:

【深耕 Python】Quantum Computing 量子计算机(1)图像绘制基础

【深耕 Python】Quantum Computing 量子计算机(2)绘制电子运动平面波

【深耕 Python】Quantum Computing 量子计算机(3)重要数学公式一览

【深耕 Python】Quantum Computing 量子计算机(4)量子物理概念(一)

【深耕 Python】Quantum Computing 量子计算机(5)量子物理概念(二)

一、积分定义式

在这里插入图片描述

二、势能公式

在这里插入图片描述

三、相关常数设置

在这里插入图片描述

四、计算数值积分的Python代码

import math
from scipy import integrateh = 6.6260896 * 10 ** -34
hbar = h / (2.0 * math.pi)me = 9.10938215 * 10 ** -31eV = 1.60217733 * 10 ** -19L = 1.0 * 10 ** -9x_min = -L / 2.0
x_max = L / 2.0n_max = 10Ex = 1.0 * 10 ** 10def verphi(n, x):kn = math.pi * (n + 1) / Lreturn math.sqrt(2.0 / L) * math.sin(kn * (x + L / 2.0))def V(x, Ex):return math.e * Ex * xdef integral_matrixElement(x, n1, n2, Ex):return verphi(n1, x) * V(x, Ex) * verphi(n2, x) / eVfor n1 in range(n_max + 1):for n2 in range(n_max + 1):result = integrate.quad(integral_matrixElement, x_min, x_max, args=(n1, n2, Ex))real = result[0]imag = 0print("(" + str(n1) + ", " + str(n2) + ") " + str(real))

积分结果:

(0, 0) 6341.738760657484
(0, 1) -3.056058246357965e+19
(0, 2) 2609.307906875312
(0, 3) -2.4448465970863724e+18
(0, 4) 6870.623927366621
(0, 5) -6.735801849115569e+17
(0, 6) 4827.5805244781905
(0, 7) -2.771934917331456e+17
(0, 8) -14813.886749646688
(0, 9) -1.4031488734426288e+17
(0, 10) -91.85343359174219
(1, 0) -3.056058246357965e+19
(1, 1) 8677.375330811079
(1, 2) -3.3005429060666024e+19
(1, 3) 7559.214463884988
(1, 4) -3.1184267819979377e+18
(1, 5) 8397.13098087583
(1, 6) -9.507736766447043e+17
(1, 7) -11203.391019872324
(1, 8) -4.175083790774072e+17
(1, 9) 2629.7575721982435
(1, 10) -2.2101670420734822e+17
(2, 0) 3305.077150828044
(2, 1) -3.3005429060666024e+19
(2, 2) 4131.0895468288745
(2, 3) -3.3679009245577576e+19
(2, 4) 18393.399430849167
(2, 5) -3.395620273731079e+18
(2, 6) -9305.413780188943
(2, 7) -1.0910885639889608e+18
(2, 8) -425.52945379666164
(2, 9) -4.982101959405064e+17
(2, 10) -2797.4992591219802
(3, 0) -2.444846597086372e+18
(3, 1) 7540.93172754931
(3, 2) -3.3679009245577572e+19
(3, 3) 10871.226664979697
(3, 4) -3.395620273731073e+19
(3, 5) 4636.680523494656
(3, 6) -3.535935161075353e+18
(3, 7) 5349.394079704496
(3, 8) -1.1717903808520607e+18
(3, 9) 18557.06635991661
(3, 10) -5.48843113631636e+17
(4, 0) 6465.045377234563
(4, 1) -3.1184267819979377e+18
(4, 2) 18407.930328892166
(4, 3) -3.395620273731072e+19
(4, 4) 5278.177294867377
(4, 5) -3.4096517624654983e+19
(4, 6) -10654.575490810419
(4, 7) -3.6166369779384207e+18
(4, 8) -3997.905026982768
(4, 9) -1.2224232985431992e+18
(4, 10) -2426.58163543784
(5, 0) -6.735801849115574e+17
(5, 1) 6890.926988234758
(5, 2) -3.3956202737310833e+18
(5, 3) 4534.457182746286
(5, 4) -3.4096517624654983e+19
(5, 5) 3642.5609606579337
(5, 6) -3.4177219441518076e+19
(5, 7) 10615.200195340132
(5, 8) -3.66726989562957e+18
(5, 9) 25011.51925503606
(5, 10) -1.2562620057692713e+18
(6, 0) 6183.626968714323
(6, 1) -9.507736766447043e+17
(6, 2) -9718.696863996012
(6, 3) -3.5359351610753536e+18
(6, 4) -10105.641181736304
(6, 5) -3.4177219441518076e+19
(6, 6) 3897.1842703463662
(6, 7) -3.4227852359209206e+19
(6, 8) -8550.64335308177
(6, 9) -3.7011086028556754e+18
(6, 10) -9318.227951041345
C:\Users\lycbu\Desktop\Python 量子计算机\Day 7\quantumWell_StarkEffect_step1.py:36: IntegrationWarning: The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved.  The error may be underestimated.result = integrate.quad(integral_matrixElement, x_min, x_max, args=(n1, n2, Ex))
(7, 0) -2.7719349173314662e+17
(7, 1) -11746.815843769886
(7, 2) -1.0910885639889618e+18
(7, 3) 4746.182689685192
(7, 4) -3.6166369779384197e+18
(7, 5) 10939.680098040822
(7, 6) -3.42278523592092e+19
(7, 7) 30312.39957168161
(7, 8) -3.426169106643533e+19
(7, 9) 59630.42734047828
(7, 10) -3.7248355357271296e+18
(8, 0) -14763.958321932972
(8, 1) -4.175083790774057e+17
(8, 2) 376.26024772313724
(8, 3) -1.171790380852062e+18
(8, 4) -2891.430230791178
(8, 5) -3.667269895629572e+18
(8, 6) -9035.816467070696
(8, 7) -3.4261691066435334e+19
(8, 8) 19862.976591607174
(8, 9) -3.4285417999306818e+19
(8, 10) -54641.972971282514
(9, 0) -1.4031488734426315e+17
(9, 1) 1654.2331507959864
(9, 2) -4.982101959405055e+17
(9, 3) 17653.776341955723
(9, 4) -1.222423298543198e+18
(9, 5) 27534.81059036405
(9, 6) -3.7011086028556774e+18
(9, 7) 58372.822664076666
(9, 8) -3.4285417999306818e+19
(9, 9) 5452.609965541867
(9, 10) -3.430269460197712e+19
(10, 0) -269.7846480739375
(10, 1) -2.2101670420734925e+17
(10, 2) -4534.741401922178
(10, 3) -5.488431136316375e+17
(10, 4) -2159.696443591254
(10, 5) -1.2562620057692713e+18
(10, 6) -8252.286148308438
(10, 7) -3.724835535727129e+18
(10, 8) -55910.908016360045
(10, 9) -3.430269460197712e+19
(10, 10) -275.15859882778125Process finished with exit code 0

参考文献 Reference

《14天自造量子计算机:使用薛定谔方程》,【日】远藤理平 著,陈欢 译,北京,中国水利水电出版社,2023年9月。

这篇关于【深耕 Python】Quantum Computing 量子计算机(6)计算<m|V|n>数值积分的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/983251

相关文章

python: 多模块(.py)中全局变量的导入

文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

【机器学习】高斯过程的基本概念和应用领域以及在python中的实例

引言 高斯过程(Gaussian Process,简称GP)是一种概率模型,用于描述一组随机变量的联合概率分布,其中任何一个有限维度的子集都具有高斯分布 文章目录 引言一、高斯过程1.1 基本定义1.1.1 随机过程1.1.2 高斯分布 1.2 高斯过程的特性1.2.1 联合高斯性1.2.2 均值函数1.2.3 协方差函数(或核函数) 1.3 核函数1.4 高斯过程回归(Gauss

poj 1113 凸包+简单几何计算

题意: 给N个平面上的点,现在要在离点外L米处建城墙,使得城墙把所有点都包含进去且城墙的长度最短。 解析: 韬哥出的某次训练赛上A出的第一道计算几何,算是大水题吧。 用convexhull算法把凸包求出来,然后加加减减就A了。 计算见下图: 好久没玩画图了啊好开心。 代码: #include <iostream>#include <cstdio>#inclu

uva 1342 欧拉定理(计算几何模板)

题意: 给几个点,把这几个点用直线连起来,求这些直线把平面分成了几个。 解析: 欧拉定理: 顶点数 + 面数 - 边数= 2。 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#inc

uva 11178 计算集合模板题

题意: 求三角形行三个角三等分点射线交出的内三角形坐标。 代码: #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cmath>#include <stack>#include <vector>#include <

【学习笔记】 陈强-机器学习-Python-Ch15 人工神经网络(1)sklearn

系列文章目录 监督学习:参数方法 【学习笔记】 陈强-机器学习-Python-Ch4 线性回归 【学习笔记】 陈强-机器学习-Python-Ch5 逻辑回归 【课后题练习】 陈强-机器学习-Python-Ch5 逻辑回归(SAheart.csv) 【学习笔记】 陈强-机器学习-Python-Ch6 多项逻辑回归 【学习笔记 及 课后题练习】 陈强-机器学习-Python-Ch7 判别分析 【学

XTU 1237 计算几何

题面: Magic Triangle Problem Description: Huangriq is a respectful acmer in ACM team of XTU because he brought the best place in regional contest in history of XTU. Huangriq works in a big compa

计算机毕业设计 大学志愿填报系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点赞 👍 收藏 ⭐评论 📝 🍅 文末获取源码联系 👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~Java毕业设计项目~热门选题推荐《1000套》 目录 1.技术选型 2.开发工具 3.功能

nudepy,一个有趣的 Python 库!

更多资料获取 📚 个人网站:ipengtao.com 大家好,今天为大家分享一个有趣的 Python 库 - nudepy。 Github地址:https://github.com/hhatto/nude.py 在图像处理和计算机视觉应用中,检测图像中的不适当内容(例如裸露图像)是一个重要的任务。nudepy 是一个基于 Python 的库,专门用于检测图像中的不适当内容。该