# Day 30: Brute Force Computations vs. Calculus

*AP Physics C:* We talked about work done by a non-constant force, using an example of a 1000-kg space rock falling to the surface of the Earth from a distance of 10 earth radii from the center of the earth. Without telling them how to approach the problem, I wanted to see what they would do on whiteboards first. A couple groups incorrectly assumed the force was constant the whole time. Other groups realized the force wasn’t constant and tried to figure out some kind of “average force” to use — one group used the force at the halfway point as the average force while another group averaged together the forces at the initial separation and final separation. Neither approach works well, so we talked about breaking the problem up into many small steps. That’s when wrote a program in VPython/Glowscript to automate that brute force method (program above, output below). We also played around with the step size to see the effect on the accuracy of the answer. How big could the step size be and still have an acceptable answer?

Then we solved the same problem using calculus. Answer below.

And we get the same answer … hooray!

I really like using VPython for these kind of problems because it really helps kids think about integration as sum of very tiny parts