Legal Notice, Disclaimer, and Book Ordering Information:

(* Legal Notice, Disclaimer, and Book Ordering Information:

Last Modified: FIO January 1, 1995

Mathematica For Physics
Robert L. Zimmerman and Fredrick I. Olness
MathSource Number: 0206-862 

ISBN 0-201-53796-6
For ordering information, call 1-800-822-6339
Addison-Wesley Publishing Company

Communication with the authors:
Fredrick I. Olness:  olness@mail.physics.smu.edu
Robert L. Zimmerman: bob@zim.uoregon.edu

Copyright 1995, Addison-Wesley Publishing Company, Inc. The material in
this file may be distributed freely  so long as the content remains
unchanged, and the copyright and  reference notices are included. The
publisher grants permission for the noncommercial use of these programs
and program segments.  All other uses require the prior written consent
of the publisher.    

All rights are reserved with regard to the  material in the
"Mathematica For Physics" text, and may not be reproduced, stored in a
retrieval system, or transmitted,  in any form or by any means,
electronic, mechanical, photocopying,  recording, or otherwise, without
the prior written permission  of the publisher. 

The programs and applications presented in this book have been included
for  their instructional value. They have been tested with care but are
not  guaranteed for any particular purpose. The publisher does not
offer any  warranties or representations, nor does it accept any
liabilities with  respect to the programs or applications. 

 *)

Chapter 6, Section 1, Problem 4: 
 Particle Propagating Towards a Rectangular Potential  
 Code to generate Animation ONLY!!!

Clear["Global`*"];

psiL[x]=E^(I*k1*x) + E^(-I*k1*x)*R;
psiR[x]=E^(I*k1*x)*T;
psiW[x]=B*E^(-I*k2*x) + A*E^(I*k2*x);

ABRTrule=
{R -> ((k1^2 - k2^2)*(Cos[2*a*k1] - I*Sin[2*a*k1])*
 
      Sin[2*a*k2])/
 
    (2*I*k1*k2*Cos[2*a*k2] + k1^2*Sin[2*a*k2] + 
 
      k2^2*Sin[2*a*k2]), 
 
  T -> (2*k1*k2*Cos[2*a*k1] - 2*I*k1*k2*Sin[2*a*k1])/
 
    (2*k1*k2*Cos[2*a*k2] - I*k1^2*Sin[2*a*k2] - 
 
      I*k2^2*Sin[2*a*k2]), 
 
  A -> ((k1 + k2)*(k1*Cos[a*(k1 + k2)] - 
 
        I*k1*Sin[a*(k1 + k2)]))/
 
    (2*k1*k2*Cos[2*a*k2] - I*k1^2*Sin[2*a*k2] - 
 
      I*k2^2*Sin[2*a*k2]), 
 
  B -> ((k1 - k2)*(k1*Cos[a*(k1 - k2)] - 
 
        I*k1*Sin[a*(k1 - k2)]))/
 
    (-2*k1*k2*Cos[2*a*k2] + I*k1^2*Sin[2*a*k2] + 
 
      I*k2^2*Sin[2*a*k2])};

kRule={k1 -> (2^(1/2)*En^(1/2)*m^(1/2))/hbar, 
 
  k2 -> (2^(1/2)*m^(1/2)*(En - V)^(1/2))/hbar};

Clear[timePlot];
timePlot[time_,wave_,Energy_,V0_,thickness_,xrange_]:= 
  Plot[( Re[Exp[-I Energy time] wave
             /.ABRTrule
             /.kRule
             //.{m->1,hbar->1,En->Energy,a->2,V->V0} 
         ] //Evaluate  )
    ,xrange
    ,Axes->None
    ,PlotStyle->Thickness[thickness]
    ,DisplayFunction->Identity   
 ];

tnumber=4;
 timestep=2 Pi/(tnumber);
 V0=1.1;
 Energy=1;
 Do[ Show[ {timePlot[time,psiL[x],Energy,V0,.006,{x,-10,-2}]
           ,timePlot[time,psiW[x],Energy,V0,.001,{x,-2,  2}]
           ,timePlot[time,psiR[x],Energy,V0,.006,{x, 2, 10}]}
        ,DisplayFunction->$DisplayFunction   ] 
   ,{time,0,2 Pi-timestep,timestep} ]