We have Newton’s local view of "object is sitting there, force kicks it, object moves” which is entirely based on cause and effect in the exact present moment.
And we also have calculus which has the “Principle of Least Action.” Instead of looking at the present second, we take a step back, look at the start point and the end point, and ask “out of the infinite, chaotic paths this thing could take, it will choose the exact path that minimizes total action."
And they are mathematically identical. When you use calculus to break down the path, it dissolves perfectly into Newton's local laws.
A great example of this are bubbles. When you blow a soap bubble, you are trapping a volume of air inside a thin film of soapy water. That film has surface tension, which means the water molecules on the surface are constantly pulling on each other, trying to shrink the bubble's surface area as much as humanly possible.
So, the math problem the bubble is trying to solve in realtime is "What shape can hold this exact amount of trapped air while using the absolute least amount of surface area?"
And mathematically, the answer to that problem is always a sphere. Spheres have the smallest possible surface area for any given volume. And because the soap film wants to minimize its energy (which, Principle of Least Action!), it perfectly balances the air pressure to form a sphere.
And the only exception to this is to force a bubble into a different shape by giving it a structural skeleton to cling to. If you dip a wire frame shaped like a cube into a soap solution, the bubble won't fill the cube like a solid block. Instead, the film will stretch across the edges, meeting at exact 120* angles to still minimize its surface area within the parameter.