Yesterday, I gave a short, five-minute talk (with accompanying paper, see [1]) on applying Python and its symbolic computational library SymPy [2] to solving very simple kinematics problems in the discipline of mechanics. The takeaway is that calculus problems aren’t hard [3], but rather tedious. Rudimentary integrals that can be broken down to dozens, sometimes even hundreds, of arithmetical operations. This is unacceptable, and scientists may turn to scientific computing to make their lives easier.

## The Task at Hand [4]

I’ll give you the TL; DR version, if you want, you can read the paper for more a somewhat more detailed discussion. Basically we have this hypothetical non-constant acceleration function:

We are interested in working out its displacement function, that is, the mathematical function that describes its motion. We compute a double integral to work out displacement, or…

Working out its displacement shouldn’t be too hard with Python. First, we import all modules from SymPy:

Next, we define the function and its constants…

Then, we’re gonna instruct Python to do the double integral…

Finally, we have……………………………….

b*t**2/2 + c*t**3/6 + d*t**4/12 + t*v_i + x_i

We have derived a mathematically pure formula for describing $$x(t)$$ from $$a(t)$$

## Conclusion

Python is great for solving numeric problems ^_^