Skip to main content
\(\require{cancel}\)
Physics LibreTexts

28: The Python Programming Language

  • Page ID
    19587
  • This appendix gives a very brief introduction to programming in python and is primarily aimed at introducing tools that are useful for the experimental side of physics.

    Learning Objectives

    • Be able to perform simple algebra using python.
    • Be able to plot a function in python.
    • Be able to propagate uncertainties in python.
    • Be able to plot and fit data to a straight line.
    • Understand how to use Python to numerically calculate any integral.

    In this textbook, we will encourage you to use computers to facilitate making calculations and displaying data. We will make use of a popular programming language called Python, as well as several “modules” from Python that facilitate working with numbers and data. Do not worry if you do not have any programming experience; we assume that you have none and hope that by the end of this book, you will have some capability to decrease your workload by using computer programming.

    The only way to become proficient at programming is through practice. If you want to effectively learn from this chapter, it is important that you take the time to actually type the commands into a Python environment rather than simply reading through the chapter. Reading through the chapter will at least give you a sense of what is possible and some terminology, but it will not teach you programming!