Metadata-Version: 2.4
Name: qmspectral
Version: 0.2.2
Summary: Spectral methods for solving the 1D Schrodinger equation
Home-page: https://github.com/ruihu/qmspectral
Author: ruihu
Author-email: ruihu <your_email@example.com>
License: MIT
Project-URL: Homepage, https://github.com/ruihu/qmspectral
Keywords: quantum,mechanics,schrodinger,spectral,chebyshev,fourier,physics
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20
Requires-Dist: scipy>=1.7
Requires-Dist: matplotlib>=3.3
Provides-Extra: gui
Requires-Dist: matplotlib>=3.3; extra == "gui"
Provides-Extra: dev
Requires-Dist: matplotlib>=3.3; extra == "dev"
Requires-Dist: tk; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# qmspectral

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

## 功能

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

## 安装

```bash
pip install qmspectral
```

## 使用示例

```python
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}")
```

### 直接使用谱方法

```python
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)
```

### 自定义势函数

```python
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
