T
HE DYNAMICS OF COLLIDING BODIESN
EW MEXICO SUPERCOMPUTING CHALLENGECategory A
By
Anthony R. Eastin, Senior
Nicholas A. Henry, Senior
Andrew K. Webb, Senior
AP Computer Science Class
Silver High School, Silver City, NM
March 30, 2000
New Mexico Supercomputing Challenge
Project Number: 014
Teacher: Mrs. Peggy Larisch
Mentor: Mr. Berry Estes
A
CKNOWLEDGEMENTS
The authors wish to acknowledge the following individuals for the guidance provided in the selection of a suitable topic, development of the computer code, solving conservation of momentum and energy equations, in the preparation of the document, and assistance provided in the overall preparation of this report:
A
BSTRACT
This New Mexico Supercomputing Challenge Final Report is prepared and issued in compliance with the set guidelines. The guidelines require the team to define a scientific based problem and develop an innovative computer based methodology for evaluating the problem and arriving at appropriate conclusions. Efforts of the team to perform these functions are described in this paper, including methods of solution. Conclusions are based on the results of these solutions.
T
ABLE OF CONTENTS
E.0 Executive Summary 1
1.0 Introduction 2
2.0 Problem Statement 3
3.0 Method of Solution 4
4.0 Data and Results 7
5.0 Conclusions 9
References
Acknowledgements
Appendix 1 (Solving Conservation of Energy and Momentum for v1’ and v2’)
Appendix 2 (Proof of Quadratic Formula)
E.0 E
XECUTIVE SUMMARY
E.1 Executive Summary
This project uses two primary equations as the basis for analyzing the aftermath of one-dimensional, two-dimensional, and three-dimensional collisions. These equations are:
m1v1 + m2v2 = m1v1’ + m2v2’
½m1v12 + ½m2v22 = ½m1v1’2 + ½m2v2’2
These two equations apply to a collision given two conditions. First, the collision is perfectly elastic, and second, there are no external forces acting on the system. Using systems of equations, the final velocities can be determined. First, the momentum equation is solved in terms of one of the final velocities. That variable is then substituted into the energy equation, leaving only one unknown. After simplifying and rearranging the equation, it resembles a quadratic equation (ax2 + bx + c). Using the quadratic formula, the final velocity of the first object (v1’) can be found. Substituting into the momentum equation, the final velocity of the second object (v2’) can be calculated. Two and three-dimensional equations are more complex because they involve angles, which require the use of trigonometry. With the use of the Pythagorean Theorem and other trigonometric identities, the resulting angles of the two objects can be determined.
Applying the aforementioned techniques to information the user inputs, the program outputs the post-collision status. In the one-dimensional system, the results are the final velocities in the negative or positive direction. In the multi-dimensional system, as in the one-dimensional system, the vectors are given in terms of both magnitude and direction; however, the direction is defined by the angle at which the objects now travel. From analysis of simple conservation equations, solutions that have relevance in real world situations can be obtained through use of the computer program.
1.0
INTRODUCTION
1.1 Purpose
The subject of this study explores various physical concepts involving kinetic energy and momentum for an elastic collision. This report opens the reader to a field of the physical aspects of a collision and entails a detailed explanation of the computer program used to evaluate its aftermath. The program prompts for the necessary elements and then solves for the desired variables of a hypothetical collision. The choice of subject is the product of a keen interest in physical phenomena within the members of this team which involves a careful observation of elements that occur in nature.
The aforementioned selection for a subject of study is an understandable, logical problem because it demands the application of physical and mathematical concepts that can be implemented in more complex situations, i.e. multiple dimensions. Logic, reasoning skills, and mathematics including trigonometry, were the basis for resolving the problem. The problem reaches a solution when the unknown variables are calculated. This is done by creating a computer program that allows input to be easily processed into solutions.
1.2 Computer Program
The C++ computer language is the selection for methodically compiling a program that will evaluate each of the variables for a collision. A range of solutions is developed within the computer program as a function of the masses and initial velocities. The program then evaluates the values for the post-collision velocities. Further applications, including second and third dimensions, are at the convenience of the user to reach a solution for as complicated a problem as he or she wishes to evaluate (see Appendices 1-3).
2.0 P
ROBLEM STATEMENT
2.1 Problem Statement
The problem investigated is divided into two major parts. The first and most basic is to learn and understand the fundamental physics principles related to the conservation of energy and conservation of momentum by investigating the dynamics of a system that involves a collision between two bodies in motion.
The second part, as a corollary to the first, is to develop the necessary relationships in equation format which associate these two conservation principles in such a manner that the system can be analyzed for one, two, and three-dimensional collisions. These equations are formatted to permit the user to define the "before collision" conditions. After this, the program will output the "after collision" status of the system. The intent of this exercise is to employ the computer as a tool for processing equations and producing computer based solutions that evaluate the basic motion of bodies in an elastic collision.
Clearly, not all variables of a problem of this nature can be investigated at this level; however, it is expected that the solutions will provide a sound basis for expanding the evaluations into a more thorough understanding of these physics principles.
3.0 M
ETHOD OF SOLUTION
3.1 Mathematical Model
The collisions are analyzed first in a one-dimensional collision system. This system is evaluated initially to provide a means for establishing the fundamental equations used throughout the computer program (see Appendix 1). The computer program is validated through hand calculations testing the output of the program. The next level of evaluation performed entails a two-dimensional collision system wherein the colliding bodies are broken up into their horizontal and vertical components (see Appendix 2). As before, the output of the computer program is verified by performing hand calculations. Finally, a three-dimensional system is analyzed in which each vector is broken down into its x, y, and z components (see Appendix 3).
As mentioned earlier, the entire study is based on two principles, one being the conservation of energy and the other being the conservation of momentum. The law of conservation of energy states that energy can neither be created, nor destroyed (however it can change its form).1 The law of conservation of momentum states that the total momentum of an isolated system of bodies remains constant. 1 However, in order for these principles to remain applicable, two conditions must be satisfied. First, there cannot be any external forces acting on the system, and second, the collision must be perfectly elastic.2 In order to simplify the collisions, two more assumptions must also be made. The objects involved in the collision are of a spherical nature and their centers of mass are directly aligned when they impact each other (in other words, they do not merely brush against each other).
In the one-dimensional system, the computer program is designed to solve for two unknowns, which are the final velocities of the two objects. In order to solve for the two unknowns, it is essential to have two equations, which are available. These two equations are those of the conservation of energy and the conservation of momentum. A solution is reached through the use of systems of equations. Using systems of equations, one variable is isolated in one equation and then substituted into the other equation so that there is only one unknown (see Appendix 6).
When this is applied to the two conservation equations, a complex equation results containing first and second degree variables. After it is rearranged it resembles a quadratic equation, albeit a complicated one. It appears as follows:
(m1m2 + m12)v1’2 - (2m12v1 + 2m1m2v2)v1’- (m1v12m2 - m12v12 -2m1v1m2v2) = 0, where v1’ is the only unknown and m1, m2, v1, and v2 are constants entered by the user.
Since it is established that this equation is quadratic, the quadratic formula (see Appendix 7) can be used, which, although providing a solution, produces various malfunctions with the computer output.
A remedy to these malfunctions was reached through methodically analyzing the computer program. After completing various checks on the possibility of an error within the written code (semi-colons, etc.) it was discovered that the problem did not lie on the part of the team members, but rather within the limitations of the C++ programming language. The first relates to the fact that C++ will not accurately process code when a negative number is placed under a square root. In all physical instances, a negative should not be under the square root. This only becomes a problem when, in certain instances, the expression b2-4ac should equal zero. The complication is that the computer, instead of calculating a zero under the square root, processes an extremely small negative number, a number that should in effect, be zero. This is caused by two things. First, C++ automatically truncates irrational numbers as well as numbers with extensive decimal places, slightly altering their values. The slight error is then magnified after a number of iterations throughout the program. This discrepancy can be remedied by taking the square root of the absolute value of the discriminant, b2-4ac. (b2-4ac is labeled the discriminant because it determines whether or not there will be a real solution.)
The second problem encountered when using the quadratic formula was that the equation offers two solutions, only one of which is correct. In any given set of solutions, one should be equal to the initial velocity, and the other should be a completely new number. Obviously, after an object goes through a collision, it cannot retain its initial velocity. Therefore, this solution can be ruled out. Using C++, a simple "If" statement can take care of this. However, the boundaries within C++ complicated what seemed to be a simple solution. Because of the errors resulting from calculating truncated irrational numbers, the solution that should have been ruled out returned a value which was close to, but not exactly equal to the initial velocity. Therefore, the "If" statement failed to serve its purpose. To correct this problem, a range (set up arbitrarily) between zero and 0.0001 was included in the "If" statement. If the absolute value of the difference between the solution and the initial velocity falls within this range, the solution is ruled out.
In the two-dimensional system, as mentioned earlier, the collision is broken up into its horizontal and vertical components. After doing this, the collision can then be evaluated as if it were two separate collisions. The horizontal components are analyzed using the same method as in the one-dimensional program. The same is done with the vertical components (see Appendix 5). After finding the components, they can be recombined using the definition of tangent to find the final angle at which each object leaves the collision. To find the magnitude of the vectors, the Pythagorean Theorem is used. After finding both the direction and magnitude of the vectors, the program has completed its task.
Finding the direction: Finding the magnitude:
tanq ’ = (v1y’/v1x’) v1’
2 = v1x’2 + v1y’2q ’ = Arctan (v1y’/v1x’)
Through the development of a computer program that evaluates the aftermath of a collision, this team has accomplished its goal of obtaining a deeper comprehension of those physics principles applicable in the dynamics of a collision.
4.0 D
ATA AND RESULTS
4.1 Calculations
After the required fields are entered into the computer program, output is generated. This is the final velocity of the first and second object involved in the collision and the new directions, determined by angles in the multi-dimensional programs, that they are now travelling in. A sample input, calculation, and result can be observed below.
Input
m1 = 10
m2 = 10
v1 = 10
v2 = 10
q = 45°
f = 135°

Output
v1’ = 10
v2’ = 10
q ’ = 315°
f ’ = 225°

5.0 C
ONCLUSIONS
5.1 Computer Program
The computer program designed by this team has reached a level of performance that is capable of performing the calculations for which it was intended. In the compilation of the written code there were various complications that required this team to work around limitations within the C++ computer programming language. Through this and the logic used to create the computer program that evaluates a practical problem, the members of this team have reached a deeper understanding in the applications of computer programming in general as well as the principles in physics utilized in the program.
The equations that are used in the evaluation of this problem, which are the conservation of energy and momentum, prove to be a valid base for the assumptions and selected input data. The results clearly show that these equations are valid for this type of application and that they can be used to predict collisions of this nature. The equations are actual components of problematic scenarios which occur in the physical world.
5.2 Data
The data attained through this program is essentially the results, or output, that the program produces. The input includes the initial velocities and masses of the two objects. The output includes the final velocities of the two objects. The final velocities vary with the program type. In a one-dimensional collision, the output is no more than the two final velocities with a negative or positive direction. In the two-dimensional program, the final velocities include a horizontal and vertical component. In the three-dimensional collision, a z-axis is included in addition to the x-y plane used in the two dimensional collision.
R
EFERENCES
New Jersey. 1998.
2000.
1999, February 2000.
A
CKNOWLEDGEMENTS
The authors wish to acknowledge the following individuals for the guidance provided in the selection of a suitable topic, development of the computer code, solving conservation of momentum and energy equations, in the preparation of the document, and assistance provided in the overall preparation of this report: