Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.1 KB

README.md

File metadata and controls

44 lines (34 loc) · 1.1 KB

schrod

A simple, accurate, and fast module for solving the single particle Schrodinger equation.

Probability distributions for V(x) = x + 0.5*x^4

Installation

  1. Make sure you have python3, numpy, and scipy. All of the these (and many more) are included with anaconda.
  2. Clone the repo:
git clone https://github.com/dhudsmith/schrod.git
  1. From inside the schrod directory execute
python setup.py install --user

Optionally you can omit --user to install for all users.

That's it. To load the package into a python shell, simply execute

import schrod

Usage

The harmonic oscillator:

import schrod, numpy

# Specify the potential
x = numpy.linspace(-5, 5, 200)
V = 1/2 * x**2

# Create and solve Schrodinger's equation
eqn = schrod.Schrod(x, V)
eqn.solve()

# Print the first five eigenvalues
print(eqn.eigs[0:5])

Output: [ 0.5 1.5 2.50000008 3.50000122 4.50001267]

For more examples, see the examples folder.