Skip to main content

Spectral methods for solving the 1D Schrodinger equation

Project description

qmspectral

Quantum Mechanics Spectral Methods - 使用谱方法(傅里叶和切比雪夫)求解一维定态薛定谔方程。

功能

  • 傅里叶谱方法: 适用于周期性边界条件
  • 切比雪夫谱方法: 适用于 Dirichlet 边界条件
  • 内置势函数:
    • 无限深势阱 (Infinite Well)
    • 简谐振子 (Harmonic Oscillator)
    • 双势阱 (Double Well)

安装

pip install qmspectral

使用示例

from qmspectral import solve

# 使用切比雪夫方法求解简谐振子
energies, wavefuncs, x = solve(
    method="chebyshev",
    potential_name="Harmonic Oscillator",
    a=-10,
    b=10,
    N=64,
    num_states=5
)

print(f"前5个能级: {energies}")

直接使用谱方法

from qmspectral import solve_chebyshev, solve_fourier
from qmspectral.potentials import harmonic

# 切比雪夫方法
energies, wavefuncs, x = solve_chebyshev(harmonic, -10, 10, N=64, num_states=5)

# 傅里叶方法
energies, wavefuncs, x = solve_fourier(harmonic, -10, 10, N=64, num_states=5)

自定义势函数

from qmspectral import solve_chebyshev
import numpy as np

def my_potential(x):
    return 0.5 * x**2 + 0.1 * x**4  # 简谐+微扰

energies, wavefuncs, x = solve_chebyshev(my_potential, -8, 8, N=128, num_states=5)

依赖

  • numpy >= 1.20
  • scipy >= 1.7

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qmspectral-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qmspectral-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file qmspectral-0.1.0.tar.gz.

File metadata

  • Download URL: qmspectral-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for qmspectral-0.1.0.tar.gz
Algorithm Hash digest
SHA256 16442d7c739f67cf13898071be710b54b1ee0746927d4475527e8fce9ebf24ea
MD5 72f3501c0d55d9cccbc94b0ac9a1a3b7
BLAKE2b-256 58aaa82153ee40d9175442f71f25f8cc496a619dcddbfda3c4d3f4c8da5ccd6e

See more details on using hashes here.

File details

Details for the file qmspectral-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qmspectral-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for qmspectral-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aaa1ffb7ea4442a5a9cfcc3a0fd3a63996071c3b2fdf0e6eefe650f8feae3e4f
MD5 39118babdb2ee13137ed1c4b0c2c3a70
BLAKE2b-256 e95c8532f64539b053aaaf926fb02e67b1a194db94b9fe69f94ebcec37e99eb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page