OpenStax with Embedded Python Demo

Welcome to the interactive version of the OpenStax textbook, created by Addison Ballif. This is a copy of the OpenStax University Physics volumes 1-3 that has python exercises and examples embedded into the text. Below are links to each of the three volumes.

The live OpenStax text can be found here (for volume 1). The version of University physics was copied March 2025 and does not reflect changes made to the textbook since then.

This text uses piodide, 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:

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.