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.2.4.tar.gz (8.5 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for qmspectral-0.2.4.tar.gz
Algorithm Hash digest
SHA256 36d09fd7ed829dba9afe75dabb5c0adefcdad05ca89586fb421922d918908c11
MD5 ea0c770eb8b0edb4074c7bddf70873d4
BLAKE2b-256 db297a58b9d98c245e1c9c7a8fb0f6b863e8807f8639b7aeeb0e8da8cdafc14e

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