Metadata-Version: 2.4
Name: qmspectral
Version: 0.1.0
Summary: Spectral methods for solving the 1D Schrodinger equation
Home-page: https://github.com/ruihu/qmspectral
Author: ruihu
Author-email: your_email@example.com
Keywords: quantum mechanics schrodinger equation spectral chebyshev fourier physics
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
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
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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
