Cody

# Problem 1280. Elastic Collision 001: 1-D

Solution 2001014

Submitted on 3 Nov 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
m1=2;u1=4;m2=2;u2=0; [v1 v2]=OneD_Elastic(m1,u1,m2,u2); assert(max([v1 v2]-[0 4])<.01)

Unrecognized function or variable 'v2'. Error in OneD_Elastic (line 6) v2=v2*((m1-m2)/(m1+m2))+(2*u1*m1)/(m1+m2);

2   Fail
m1=6;u1=4;m2=6;u2=2; [v1 v2]=OneD_Elastic(m1,u1,m2,u2); assert(max([v1 v2]-[2 4])<.01)

Unrecognized function or variable 'v2'. Error in OneD_Elastic (line 6) v2=v2*((m1-m2)/(m1+m2))+(2*u1*m1)/(m1+m2);

3   Fail
m1=6;u1=4;m2=3;u2=2; [v1 v2]=OneD_Elastic(m1,u1,m2,u2); assert(max([v1 v2]-[2.6667 4.6667])<.01)

Unrecognized function or variable 'v2'. Error in OneD_Elastic (line 6) v2=v2*((m1-m2)/(m1+m2))+(2*u1*m1)/(m1+m2);

4   Fail
m1=3;u1=6;m2=3;u2=-6; [v1 v2]=OneD_Elastic(m1,u1,m2,u2); assert(max([v1 v2]-[-6 6])<.01)

Unrecognized function or variable 'v2'. Error in OneD_Elastic (line 6) v2=v2*((m1-m2)/(m1+m2))+(2*u1*m1)/(m1+m2);

5   Fail
m1=1;u1=100;m2=100;u2=0; [v1 v2]=OneD_Elastic(m1,u1,m2,u2); assert(max([v1 v2]-[-98.0198 1.9802])<.01)

Unrecognized function or variable 'v2'. Error in OneD_Elastic (line 6) v2=v2*((m1-m2)/(m1+m2))+(2*u1*m1)/(m1+m2);

6   Fail
m1=6;u1=-4;m2=4;u2=-6; [v1 v2]=OneD_Elastic(m1,u1,m2,u2); assert(max([v1 v2]-[-5.6 -3.6])<.01)

Unrecognized function or variable 'v2'. Error in OneD_Elastic (line 6) v2=v2*((m1-m2)/(m1+m2))+(2*u1*m1)/(m1+m2);