Download presentation
Presentation is loading. Please wait.
Published byJonas Reeves Modified over 9 years ago
1
Elastic Collisions & Sierpinski Carpet Anakaren Santana
2
Elastic Collisions
3
Method 1.Set up initial conditions (make sure both masses will actually collide). 2.For loop changes positions of the masses according to their respective velocities. 3.An if statement checks if the masses collide. When they collide the new velocities are calculated and initial positions reset. 4.A second for loop changes the positions of the masses according to these new velocities and initial coordinates.
4
1D: m1=2 m2=2, U1=2 U2=0, x01=0 x02=20 Run Code With: elasticCollision.m
5
2D: m1=2 m2=4, Ux1=4 Uy2=4, Ux2=-1 Uy2=-1, x01=-90 y01=-90, x02=90 y02=90 Run Code With: elasticCollision2D.m
6
The Sierpinski Carpet is a fractal of fractal dimension 1.8929. It begins with a square that you divide into 9 sub-squares and remove the center square. Repeat the process with each subsquare. Method: – Nested for loops within a while loop. – The while loop ensures that we can keep dividing by 3. – The nested for loops “remove” the appropriate squares in each iteration.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.