Calculation Recipes

Recipes for using python as a (powerful) calculator:

  1. Calculate Interactively: I want to do a physics calculation that would be easy to do incorrectly in a calculator, and/or I might need to repeat it with different givens.
  2. Use Python Functions: I want to use predefined mathematical (or other) functions, like sine or absolute-value, in my calculation.
  3. Use Complex Numbers: I want to do a calculation that involves complex numbers.
  4. Print Formatted Output: I want to control the output of my code so that I can include text, specify precision, and so on.
  5. Script a Calculation: I want to make a multi-step calculation easier to construct and debug, run multiple times, run again later, and/or have a permanent record of.
  6. Ask for User Input: I want to be able to run my script (or let someone else run it) with various given values, without having to edit the script each time.