A Computational Revisit of the Variational Principle: Estimating Ground State Energies of the 1D Harmonic Oscillator via Python

  • Bikash Kumar Naik Government Polytechnic, Darlipali, Dist-Sundargarh
Keywords: Optimization, Python, Quantum Harmonic Oscillator, Trail Wavefunction, Variational Principle

Abstract

Purpose of the study:To estimate the ground state energy of the one-dimensional harmonic oscillator using the variational principle and Python-based numerical methods.

Methodology:Python 3.11 was used with NumPy, SciPy, and Matplotlib libraries. The variational method was applied using multiple trial wavefunctions. Integrals were computed via Simpson’s rule, and optimization was done through parameter scanning.

Main Findings:The Gaussian trial wavefunction produced a ground state energy of 0.5003 ℏω, showing 0.06% error. Other trial functions were less accurate. The results confirm that the choice of trial function critically affects the energy estimate, and Python effectively supports variational computations in quantum systems.

Novelty/Originality of this study:This study integrates computational tools with the variational principle, presenting an accessible approach to energy estimation in quantum mechanics. It demonstrates how Python can facilitate variational analysis, making the method replicable and educationally useful for students and researchers.

References

A. S. Gevorkyan and A. V. Bogdanov, “Time-dependent 4D quantum harmonic oscillator and reacting hydrogen atom,” Symmetry, vol. 15, no. 1, p. 252, 2023, doi: 10.3390/sym15010252.

M. Calvanese Strinati and C. Conti, “Non-Gaussianity in the quantum parametric oscillator,” Phys. Rev. A, vol. 109, no. 6, Art. no. 063519, 2024. doi: 10.1103/PhysRevA.109.063519.

J.-M. Lihm and C.-H. Park, “Gaussian time-dependent variational principle for the finite-temperature anharmonic lattice dynamics,” Phys. Rev. Research, vol. 3, no. L032017, 2021, doi: 10.1103/PhysRevResearch.3.L032017.

S. S. Coelho, L. Queiroz, and D. T. Alves, “Exact solution of a time-dependent quantum harmonic oscillator with two frequency jumps via the Lewis–Riesenfeld dynamical invariant method,” Entropy, vol. 24, no. 12, p. 1851, 2022, doi: 10.3390/e24121851.

J. S. Kottmann, S. Alperin-Lea, T. Tamayo-Mendoza, et al., “Tequila: A platform for rapid development of quantum algorithms,” Quantum Sci. Technol, vol. 6, no. 2, 2021, doi: 10.1088/2058-9565/abe567.

W. Li, J. Allcock, L. Cheng, et al., “TenCirChem: An efficient quantum computational chemistry package for the NISQ era,” J. Chem. Theory Comput, vol. 19, no. 13, 2023, doi:10.1021/acs.jctc.3c00319 .

D. J. Griffiths, Introduction to Quantum Mechanics, 2nd ed., Pearson Prentice Hall, 2005.

Python Software Foundation, "Python Language Reference, Version 3.10," available online: https://docs.python.org/3/, 2024.

B. Kumar Naik, “Solution for simple classical systems using SCILAB,” Phys. Educ., vol. 4, no. 3, 2022, doi: 10.1142/S2661339522500147.

S. V. R. Raghavan and V. Iyer, " Implementation details of a variational method to solve the time independent Schrödinger equation," Revista Mexicana de Física E, vol. 63, no. 3, pp. 201-206, 2017.

N. Yuki, "Quantum Mechanics with Python: Solving the 1D Time Independent Schrödinger Equation," Medium, 2020.

S. McArdle, S. Endo, A. Aspuru-Guzik, S. C. Benjamin, and X. Yuan, “Quantum computational chemistry,” Rev. Mod. Phys., vol. 92, no. 1, 2020, doi: 10.1103/RevModPhys.92.015003..

G. Devillanova, F. G., and F. and Maddalena, “Variational functionals for the driven quantum harmonic oscillator,” Complex Var. Elliptic Equations, vol. 66, no. 2, pp. 312–335, Feb. 2021, doi: 10.1080/17476933.2020.1720006.

L.-X. Cheng and D.-B. Zhang, “Variational quantum simulation of ground states and thermal states for lattice gauge theory with multi-objective optimization,” Phys. Lett. A, vol. 546, p. 130516, 2025, doi: https://doi.org/10.1016/j.physleta.2025.130516.

B. K. Naik, "Understanding oscillation using Scilab graphs," Phys. Teach, vol. 62, pp. 58–61, 2024, doi: 10.1119/5.0123308

S. Chowdhury, “Variational Monte Carlo Method Applied to Ground State of Simple Harmonic Oscillator Using Acceptance-Rejection Sampling Utilizing Mathematica BT - Monte Carlo Methods Utilizing Mathematica®: Applications in Inverse Transform and Acceptance-Rejection Sampling,” S. Chowdhury, Ed., Cham: Springer Nature Switzerland, 2023, pp. 111–131. doi: 10.1007/978-3-031-23294-7_5

H. Singh, S. Majumder, and S. Mishra, “Benchmarking of different optimizers in the variational quantum algorithms for applications in quantum chemistry,” J. Chem. Phys., vol. 159, no. 4, p. 44117, Jul. 2023, doi: 10.1063/5.0161057.

D. Bertram, “Numerical Methods in Quantum Propagation,” Fisica.Uniud.It, no. 19, 2010, [Online]. Available: http://www.fisica.uniud.it/~giannozz/Corsi/MQ/LectureNotes/mq.pdf

J. R. Trail, “Heavy-tailed random error in quantum Monte Carlo,” Phys. Rev. E, vol. 77, no. 1, p. 16703, Jan. 2008, doi: 10.1103/PhysRevE.77.016703.

N. Moll et al., “Quantum optimization using variational algorithms on near-term quantum devices,” Quantum Sci. Technol., vol. 3, no. 3, 2018, doi: 10.1088/2058-9565/aab822.

T. A. Walker and S. L. Braunstein, “Five-wave-packet linear optics quantum-error-correcting code,” Phys. Rev. A, vol. 81, no. 6, p. 62305, Jun. 2010, doi: 10.1103/PhysRevA.81.062305.

M. J. Koh, R. K. M. Khan, S. Torker, M. Yu, M. S. Mikus, and A. H. Hoveyda, “High-value alcohols and higher-oxidation-state compounds by catalytic Z-selective cross-metathesis,” Nature, vol. 517, no. 7533, pp. 181–186, 2015, doi: 10.1038/nature14061.

J.-M. Lihm and C.-H. Park, “Gaussian time-dependent variational principle for the finite-temperature anharmonic lattice dynamics,” Phys. Rev. Res., vol. 3, no. 3, p. L032017, Jul. 2021, doi: 10.1103/PhysRevResearch.3.L032017.

A. S. Gevorkyan and A. V. Bogdanov, “Time-dependent 4D quantum harmonic oscillator and reacting hydrogen atom,” Symmetry (Basel)., vol. 15, no. 1, p. 252, Jan. 2023, doi: 10.3390/sym15010252..

M. Calvanese Strinati and C. Conti, “Non-Gaussianity in the quantum parametric oscillator,” Phys. Rev. A, vol. 109, no. 6, p. 63519, Jun. 2024, doi: 10.1103/PhysRevA.109.063519.

S. S. Coelho, L. Queiroz, and D. T. Alves, “Exact solution of a time-dependent quantum harmonic oscillator with two frequency jumps via the lewis–riesenfeld dynamical invariant method,” Entropy, vol. 24, no. 12, p. 1851, Dec. 2022, doi: 10.3390/e24121851.

J. S. Kottmann et al., “TEQUILA: a platform for rapid development of quantum algorithms,” Quantum Sci. Technol., vol. 6, no. 2, p. 24009, 2021, doi: 10.1088/2058-9565/abe567.

W. Li et al., “TenCirChem: An Efficient Quantum Computational Chemistry Package for the NISQ Era,” J. Chem. Theory Comput., vol. 19, no. 13, pp. 3966–3981, Jul. 2023, doi: 10.1021/acs.jctc.3c00319.

W. van Dijk and F. M. Toyama, “Accurate numerical solutions of the time-dependent Schr"odinger equation,” Phys. Rev. E, vol. 75, no. 3, p. 36707, Mar. 2007, doi: 10.1103/PhysRevE.75.036707.

G. K. Krasin, S. I. Kudryashov, P. A. Danilov, N. A. Smirnov, A. O. Levchenko, and M. S. Kovalev, “Correction to: ultrashort-laser electron–hole plasma and intragap states in diamond,” Eur. Phys. J. D, vol. 75, no. 9, p. 254, 2021, doi: 10.1140/epjd/s10053-021-00257-7.

M. Reh, M. Schmitt, and M. Gärttner, “Time-Dependent Variational Principle for Open Quantum Systems with Artificial Neural Networks,” Phys. Rev. Lett., vol. 127, no. 23, p. 230501, Dec. 2021, doi: 10.1103/PhysRevLett.127.230501.

P. Bermejo and R. Orús, “Variational quantum non-orthogonal optimization,” Sci. Rep., vol. 13, no. 1, p. 9840, 2023, doi: 10.1038/s41598-023-37068-2.

Published
2025-06-05
How to Cite
[1]
B. K. Naik, “A Computational Revisit of the Variational Principle: Estimating Ground State Energies of the 1D Harmonic Oscillator via Python”, Sch. Jo. Phs. Ed, vol. 6, no. 2, pp. 43-63, Jun. 2025.
Section
Articles