You are on page 1of 4

Chemistry 450

Mathcad Demonstration 1

ORIGIN := 1

This defines the function "eigensort" which you will use to sort the eigenvectors. The assignment template will define this for you. Need we say, "Ne touche pas"?!

eigensort ( , S) :=

M augment , S M csort ( M , 1) M1

)
T

S submatrix ( M , 1 , rows ( M) , 2 , cols ( M) )

S)

This defines the Hermite polynomial, Hn(x).

herm ( n , x) :=

1 if n = 0 ( 2 x) if n = 1 [ 2 x herm ( n 1 , x) 2 ( n 1) herm ( n 2 , x) ] otherwise

This MATHCAD worksheet uses "particle-in-a-box" wave functions as a basis set to solve the harmonic oscillator problem. = reduced mass L = width of the box k = force constant xe = equilibrium bond length

The values selected are appropriate for HCl. All quantities are expressed in "atomic units".

:= 1500

k := 0.2 2 n x sin L L

L := 5

hbar := 1
2

xe := 2.5
2 2

x.e

( n , x) :=

Ebox ( n) :=

hbar n 2 L
2

Here, we define the potential energy function for the harmonic oscillator and then supply the formula for evaluating matrix elements of the potential.

V ( x) :=

1 2 k x xe 2
L

v ( m , n) := V ( x) ( m , x) ( n , x) dx 0

Here we define the formula for evaluating matrix elements of the harmonic oscillator hamiltonian.

( m , n) :=

1 if m = n 0 otherwise

h ( m , n) := Ebox ( n) ( m , n) + v ( m , n)
Here, we construct the hamiltonian matrix.

h ( 1 , 1) = 0.082

nmax := 10 m := 1 .. nmax n := 1 .. nmax Hm , n := h ( m , n) H1 , 1 = 0.082

m,n : h(m,n)

.... and now we find the eigenvalues and eigenvectors of the hamiltonian matrix. A quick "call" to the "eigensort" function re-arranges the eigenvalues and eigenvectors so that they are energy-ordered.

Ev := eigenvals ( H)

C := eigenvecs ( H)

( Ev C ) := eigensort ( Ev , C)

Ev are the approximate energies for the harmonic oscillator and E(n) are the exact energies. How well do they compare?

n := 0 .. 9 n = Evn+1 =
0 1 2 3 4 5 6 7 8 9 0.00727 0.02302 0.05334 0.07821 0.14000 0.16879 0.26983 0.29558 0.44299 0.45867

| | | | | | | | | | | | | | | | | | |

:=

1 E ( v) := hbar v + 2

0.00577 0.01732 0.02887 0.04041 0.05196 E ( n) = 0.06351 0.07506 0.08660 0.09815 0.10970

(v,x) are the approximate wave functions. ho(v,x) are the exact wave functions.

nmax

( v , x) :=

m =1
______________________________________________________________________________________

Cm , v+1 ( m , x)

x x z ( x) := ( e) hbar
1 ho ( v , x) := v 2 v!

z ( x) 2 herm ( v , z ( x) ) e 2
1 2 1 4

hbar

Here, we plot the approximate wave function and the exact wave function on the same set of axes. How do they compare?

x := 0 , 0.01 .. L

2 ( 0 , x) ho ( 0 , x) 1 0 1

2 x

______________________________________________________________________________________

otherwise