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 3, Section 3, Problem 2:   
  Three Coupled Harmonic Oscillators  
  Code to Generate Animation ONLY!!!

Clear["Global`*"];

allRules={x1[t] -> (phase1 + c1*t)/3^(1/2) + (c2*Cos[phase2 + freq2*t])/2^(1/2) + 
 
    (c3*M*Cos[phase3 + freq3*t])/(2^(1/2)*(2*m^2 + M^2)^(1/2)), 
 
  x2[t] -> (phase1 + c1*t)/3^(1/2) - 
 
    (2^(1/2)*c3*m*Cos[phase3 + freq3*t])/(2*m^2 + M^2)^(1/2), 
 
  x3[t] -> (phase1 + c1*t)/3^(1/2) - (c2*Cos[phase2 + freq2*t])/2^(1/2) + 
 
    (c3*M*Cos[phase3 + freq3*t])/(2^(1/2)*(2*m^2 + M^2)^(1/2)), freq1 -> 0, 
 
  freq2 -> (k/m)^(1/2), freq3 -> (k/m + (2*k)/M)^(1/2), k -> 1, m -> 1, M -> 2, 
 
  phase1 -> 0, phase2 -> 0, phase3 -> 0};

Do[
  ListPlot[( {{x1[t]-2,0},{x2[t],0},{x3[t]+2,0}} 
                   //.allRules  
                   //.{c1->0, c2->1, c3->1} 
                   //Evaluate ) 
             ,PlotStyle->{PointSize[0.05]}
             ,PlotRange->{{-4,4},{-1,1}}
          ]
,{t,0,4,1/4}];