sort eigenvectors.pdf

  • Upload
    np484

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

  • 8/2/2019 sort eigenvectors.pdf

    1/4

    v m n,( )0

    L

    xV x( ) m x,( ) n x,( )

    d:=

    V x( )1

    2k x xe( )

    2:=

    Here, we define the potential energy function for the harmonic oscillator and then supply the formula for

    evaluating matrix elements of the potential.

    Ebox n( )hbar

    2n

    2 2

    2 L2:= n x,( )

    2

    Lsin

    n xL

    :=

    x.exe 2.5:=hbar 1:=L 5:=k 0.2:= 1500:=

    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".

    herm n x,( ) 1 n 0=if

    2 x( ) n 1=if

    2 x herm n 1 x,( ) 2 n 1( ) herm n 2 x,( )[ ] otherwis

    :=

    This defines the Hermite polynomial, Hn(x).

    eigensort S,( ) M augment ST,( )M csort M 1,( )

    M1

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

    S( )

    :=

    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"?!

    Chemistry 450

    Mathcad Demonstration 1

    ORIGIN 1:=

  • 8/2/2019 sort eigenvectors.pdf

    2/4

    E n( )

    0.00577

    0.01732

    0.02887

    0.04041

    0.05196

    0.06351

    0.07506

    0.08660

    0.09815

    0.10970

    =

    E v( ) hbar v1

    2+

    :=

    Evn 1+0.00727

    0.02302

    0.05334

    0.07821

    0.14000

    0.16879

    0.26983

    0.29558

    0.44299

    0.45867

    =n0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    =

    k

    :=

    n 0 9..:=|

    |

    |

    |

    |

    |

    |

    |

    ||

    |

    |

    |

    |

    |

    |

    |

    |

    |

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

    do they compare?

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

    C eigenvecs H( ):=Ev eigenvals H( ):=

    .... 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.

    H1 1, 0.082=m,n : h(m,n)HHm n, h m n,( ):=

    n 1 nmax..:=m 1 nmax..:=

    nmax 10:=

    Here, we construct the hamiltonian matrix.

    h 1 1,( ) 0.082=h m n,( ) Ebox n( ) m n,( ) v m n,( )+:=

    m n,( ) 1 m n=if

    0 otherwise

    :=

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

  • 8/2/2019 sort eigenvectors.pdf

    3/4

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

    v x,( )

    1

    nmax

    m

    Cm v 1+, m x,( )=

    :=

    _____________________________________________________________________________________

    z x( ) hbar

    1

    2

    x xe( ):=

    ho v x,( )1

    2v

    v!

    1

    2 hbar

    1

    4

    herm v z x( ),( ) e

    z x( )2

    2

    :=

    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..:=

    0 1 2 3 4 51

    0

    1

    2

    0 x,( )

    ho 0 x,( )

    x

    _____________________________________________________________________________________

  • 8/2/2019 sort eigenvectors.pdf

    4/4