Skip to content
Advertisement

Tag: physics

Snell’s Law not functioning

I am writing a program to calculate light refraction using snell’s law, however, when I run the program it prints -0.7076118148 rather than the correct value of 22 Answer You’re using degrees instead of radians. You’ll have to convert, e.g like this: => 22.082413194472252

Elastic collision simulation

I’m trying to simulate elastic collision using the One-dimensional Newtonian equation (https://en.wikipedia.org/wiki/Elastic_collision) with pygame. The thing is that even if I transcribed the solved equation to change the velocity of the 2 bodies, it is not working (or probably there is something wrong with the code). Here it is the code: Since the 2 masses are equal, after the collision

Advertisement