80 likes | 215 Vues
This project combines the fascinating concepts of elastic collisions with the creation of the Sierpinski Carpet fractal. Learn how to simulate elastic collisions where both momentum and kinetic energy are conserved through coding. The method involves setting up initial conditions and utilizing loops and if-statements to manage collision dynamics. Additionally, discover the iterative process of creating a Sierpinski Carpet, a fractal with a dimension of 1.8929, by recursively dividing squares. Perfect for enthusiasts of physics and programming alike!
E N D
ElasticCollisions &SierpinskiCarpet Anakaren Santana
ElasticCollisions • Momentum isConserved: • KineticEnergyisConserved: • WhereU’s are velocitiesbeforethecollision and V’s are velocitiesafterthecollision. • Usingtheseequationsyou can solvefor and calculatethe position of eachmass at a given time ( x = V*t)
Method • Set up initialconditions (makesurebothmasseswillactuallycollide). • Forloopchanges positions of themassesaccordingtotheirrespectivevelocities. • Anifstatementchecksifthemassescollide. Whentheycollidethe new velocities are calculated and initial positions reset. • A secondforloopchangesthe positions of themassesaccordingtothese new velocities and initialcoordinates.
1D: m1=2 m2=2, U1=2 U2=0, x01=0 x02=20RunCodeWith: elasticCollision.m
2D: m1=2 m2=4, Ux1=4 Uy2=4, Ux2=-1 Uy2=-1, x01=-90 y01=-90, x02=90 y02=90RunCodeWith: elasticCollision2D.m
TheSierpinskiCarpetis a fractal of fractal dimension 1.8929. • Itbeginswith a squarethatyou divide into 9 sub-squares and removethe center square. Repeattheprocesswitheachsubsquare. • Method: • Nestedforloopswithin a whileloop. • Thewhileloopensuresthatwe can keepdividingby 3. • Thenestedforloops “remove” theappropriatesquares in eachiteration.