In this work, I explored reflection, its visualization, and its mathematical model. I started with a simple problem—a ball in a square. This “ball” is actually a mathematical vector, i.e., a dimensionless point that has a position and direction, but for simplicity, we will continue to refer to it as a ball. I also ignored air resistance, energy loss during reflection, etc., for simplicity. The ball is thus thrown into the square from some initial position and angle. When it hits the side of the square, it bounces off. As it moves, it also leaves a trajectory behind. This simulation can be seen in the interactive window below. You can experiment with it and change the initial angle to a different value.
While some initial angle values create very simple trajectories that loop back on themselves (at angles of 45° and 90°), other values create very chaotic trajectories. The question is whether, after a sufficient number of bounces, these trajectories will also close in on themselves and begin to simply trace their own paths. As can be seen in the diagram below, each bounce can be assigned an angle φ(n) and a length L(n) from the left edge of the side of the square where the ball landed.
Each side is 1 unit long. The initial parameters are therefore the angle φ(0) and the distance from the left edge of the side L(0). A ball released in this way will then bounce, yielding pairs of numbers φ(1) and L(1), then φ(2) and L(2), and so on… Therefore, if we want to prove whether the trajectory closes at a certain initial angle and distance from the left edge of the side, we are interested in whether there exist numbers φ(n) and L(n) such that φ(0) = φ(n) and L(0) = L(n). In other words, we are interested in whether the ball will eventually return to the point from which it was launched and bounce off it at the same angle. To understand more precisely what happens mathematically during the bounces, I wrote an algorithm that takes two parameters—φ(n) and L(n). The algorithm then precisely calculates the values of φ(n + 1) and L(n + 1), i.e., the values for the next bounce.
POKUD φ(n) < 90°:
POKUD tan(φ(n)) * (1 – L(n)) < 1:
φ(n + 1) = 90° - φ(n)
L(n + 1) = tan(φ(n)) * (1 – L(n))
POKUD tan(φ(n)) * (1 – L(n)) = 1:
φ(n + 1) = φ(n)
L(n + 1) = 0
POKUD tan(φ(n)) * (1 – L(n)) > 1:
φ(n + 1) = 180° - φ(n)
L(n + 1) = 1 – (tan(90° - φ(n)) + L(n))
POKUD φ(n) = 90°:
φ(n + 1) = φ(n)
L(n + 1) = L(n)
POKUD φ(n) > 90°:
POKUD tan(180° - φ(n)) * L(n) < 1:
φ(n + 1) = 270° - φ(n)
L(n + 1) = 1 – (tan(180° - φ(n)) * L(n))
POKUD tan(180° - φ(n)) * L(n) = 1:
φ(n + 1) = φ(n)
L(n + 1) = 1
POKUD tan(180° - φ(n)) * L(n) > 1:
φ(n + 1) = 180° - φ(n)
L(n + 1) = 1 + tan(150° - φ(n)) - L(n)
So, we only need to input two basic parameters (the initial angle and position) into the algorithm, and it will give us the two parameters for the next step. We can gradually add these pairs of numbers to a set of numerical sequences (let’s call this set M). The question “Will the ball’s trajectory ever close?” is logically equivalent to the question “Is the sequence M periodic?”. Unfortunately, I do not yet know how to answer this question.
I decided to continue working on the bounce simulation and extend it to 3D. In this simulation, the ball bounces off the walls of a cube in three-dimensional space. Unfortunately, this simulation cannot be used on the web in the form of an interactive frame. Therefore, only the code and the output in the form of images are provided here.
The various images above are generated by releasing the ball from the center of the cube in different directions. As can be seen, this initial direction significantly influences the shape of the trajectory. Some trajectories close in on themselves after just a few bounces, while others appear rather chaotic. Just as with the 2D simulation, it is quite difficult to determine whether even very chaotic-looking trajectories will eventually close in on themselves after a sufficient number of bounces and simply trace each other from there on. Below is an interactive demo I created for this 3D simulation.