OpenStax Physics (with Python)

University Physics is a three-volume collection that meets the scope and sequence requirements for two- and three-semester calculus-based physics courses. Volume 1 covers mechanics, sound, oscillations, and waves. Volume 2 covers thermodynamics, electricity and magnetism, and Volume 3 covers optics and modern physics. This textbook emphasizes connections between theory and application, making physics concepts interesting and accessible to students while maintaining the mathematical rigor inherent in the subject. Frequent, strong examples focus on how to approach a problem, how to work with the equations, and how to check and generalize the result.

This version of OpenStax is a custom version hosted by BYU-Idaho Physics Department. It has been modified to include computational methods exercises. The text features imbedded python code cells that run in-browser so students have no need to install python on their computers. This version of OpenStax University Physics was copied March 2025. Any changes made to the University Physics textbooks since then may not be reflected in this version of the text. The live OpenStax text can be found here (for volume 1).

A summary of the Python material covered in this modification of the text is found here.

Contributing Authors

Stephen D. Druger, Northwestern University
David Anderson, Albion College
Daniel Bowman, Ferrum College
Gerald Friedman, Santa Fe Community College
Edw. S. Ginsberg, University of Massachusetts
Kenneth Podolak, Plattsburgh State University
Takashi Sato, Kwantlen Polytechnic University
David Smith, University of the Virgin Islands
Joseph Trout, Richard Stockton College
Kevin Wheelock, Bellevue College
Dedra Demaree, Georgetown University
Richard Ludlow, Daniel Webster College
Patrick Motl, Indiana University Kokomo
Lev Gasparov, University of North Florida
Lee LaRue, Paris Junior College
Mark Lattery, University of Wisconsin
Tao Pang, University of Nevada, Las Vegas
Alice Kolakowska, University of Memphis

Senior Contributing Authors

William Moebs, Formerly of Loyola Marymount University
Samuel J. Ling, Truman State University
Jeff Sanny, Loyola Marymount University
Code support written by Addison Ballif.

This work is based on the original textbook University Physics by OpenStax, licensed under CC BY 4.0. This version has been modified by Brigham Young University - Idaho, Physics Department. The original work is available at openstax.org.

For help on editing the text, see here.

Python Cell Demonstration

Throughout the text are python cells similar to that shown below.

This text uses pyodide and code-mirror to make python runnable from the browser. Below is an example of the code cells that can be embedded throughout the text.

# import the array from numpy from numpy import array # create an array vector A = array([91.8, -131.1]) B = array([173.2, 100.0]) C = array([-114.7, 80.3]) print(A, B, C)

Here is another code cell that features matplotlib support.

from matplotlib import pyplot as plt plt.clf() plt.plot([1,2,3,4,5]) plt.show()

Look for these chode cells throughout the text and think about how they can make physics more interesting.

P.S. You can also have equations like H^ψ(x)=Eψ(x) or you can put them on their own line like so ×E=Bt. Hopefully that is useful.

We can also have animated "manipulate" style plots.

from numpy import sin # define a (wave) function to animate omega = 1 k = 1 phi0 = 0 A = 2 def f(x, t): return A*sin(k*x - omega*t + phi0) # plot it with the Manipulate function Manipulate(f, xlim=(-10, 10), ylim=(-3, 3), tlim=(0, 10))