## Examples to Check the collide function
more off

disp("If both masses are equal then velocities should be exchanged");
disp("1,4 -> ");
[v1,v2]= collide( 1 , 4, 1 , 1 ) 

disp("If both masses are equal and one is stationary, then velocities should be exchanged");
disp("1,0 -> ");
[v1,v2]= collide( 1 , 0, 1 , 1 ) 

disp("If centre of mass stationary then velocities should both reverse");
disp("1,-1,1,1 -> ");
[v1,v2]= collide( 1 , -1, 1 , 1 ) 
disp("1,-0.25,1,1/4 (ie second guy has mass 4) -> ");
[v1,v2]= collide( 1 , -1.0/4, 1 , 1.0/4 ) 

     disp("If bounce off a stationary wall, velocity reverses");
disp("1,0,1,0 (ie second guy has mass infinity) -> (expect -1) ");
[v1,v2]= collide( 1 , 0, 1 , 0.0 ) 

     disp("If bounce off a moving wall, velocity increases by twice the difference");
disp("1,-1,1,0 (ie second guy has mass infinity) -> (expect -3, and wall continues at -1)");
[v1,v2]= collide( 1 , -1, 1 , 0.0 ) 

     disp("If a moving wall hits a stationary mass, the velocity is 2*v_wall) ");
disp("0,-1,1,0 (ie second guy has mass infinity) -> (expect -2, and wall continues at -1");
[v1,v2]= collide( 0 , -1, 1 , 0.0 ) 

## finally, put in random condition and check for energy and momenutm conservation.
     m1=1.9 ; m2 = 2.9 ;
     u1=0.94;u2=0.874 ;
[v1,v2]= collide( u1,u2,1.0/m1,1.0/m2);
Energybefore = 0.5* ( m1*u1**2  + m2*u2**2 ) 
Energyafter  = 0.5* ( m1*v1**2  + m2*v2**2 ) 
Momentbefore =  ( m1*u1  + m2*u2 ) 
Momentafter  =  ( m1*v1  + m2*v2 ) 
