Skip to content
Snippets Groups Projects
Commit 72e4d8d2 authored by Chelsea Guan's avatar Chelsea Guan
Browse files

Added Jupyter quizes based on the MCQ in the lecture slides

Quiz questions are formatted as JSON files separated by folders based on lecture number.
parent 4b4fdf48
No related branches found
No related tags found
1 merge request!2Added Jupyter quizes based on the MCQ in the lecture slides
Showing
with 418 additions and 0 deletions
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
(ch:energy)=
# Energy
......@@ -30,6 +42,31 @@ $$ (defwork2)
Equation&nbsp;{eq}`defwork2` is the most general version of the definition of work; it simplifies to&nbsp;{eq}`onedimwork` for movement along a straight line, and to&nbsp;{eq}`defwork1` if both the path is straight and the force constant<sup>[^1]</sup>.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter4/c4q1.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter4/c4q2.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{index} conservative force
```
In general, the work done depends on the path taken - for example, it's more work to take a detour when biking from home to work, assuming the air drag is the same everywhere. However, in many important cases the work done in getting from one point to another depends on the endpoints only. Forces for which this is true are called *conservative forces*. As we'll see below, the force exerted by a spring and that exerted by gravity are both conservative.
......@@ -42,6 +79,23 @@ $$
P = \frac{\mathrm{d}W}{\mathrm{d}t}.
$$ (defpower)
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter4/c4q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c4q3_power.png
:name: fig:c4q3_power
:width: 300px
```
Power is measured in Joules per second, or Watts (W). To find out how much work is done by an engine that has a certain power output, we need to integrate that output over time:
$$
......
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
(ch:entropy)=
# Heat engines, entropy, and free energy
......@@ -120,6 +132,18 @@ $$ (adiabaticparameter)
is the *adiabatic exponent*, and we've used the fact that for an ideal gas $C_p = C_V + R$.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter14/c14q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
To find the actual value of $\gamma$, we go back to the equipartition theorem (equation&nbsp;{eq}`equipartition`), which tells us that per molecule, the internal energy of an ideal gas is $(d/2) \kB T$, where $d$ is the number of degrees of freedom. The total internal energy for $N$ molecules is then $(d/2) N \kB T = (d/2) n R T$, where $n = N/N_\mathrm{A}$ is the number of moles. Because we also have $\Delta U = n C_V T$, we can simply read off that $C_V = (d/2)R$, and $C_p = C_V + R = (1+d/2)R$, so $\gamma = \frac{1+d/2}{d/2} = 1+2/d$. For a monatomic ideal gas, $d=3$ (as the atoms can move freely in three directions), for a diatomic $d=5$ (as the molecules can also rotate around two axes, but rotating around the symmetry axis doesn't change anything), and for a triatomic non-linear gas $d=6$. For mixtures, we can have different values of $d$, and consequently of $\gamma$, but we always have $1 < \gamma < 5/3$.
It is now easy to see why the adiabatic line in a $pV$&nbsp;diagram drops faster than that of an isothermal process: for an isotherm, $p \sim 1/V$, whereas for an adiabat, $p \sim 1/V^\gamma$, with $\gamma > 1$. To determine the constant in equation&nbsp;{eq}`adiabaticequation`, we simply substitute the values of $p$ and $V$ at a known point, say $(p_1, V_1)$. Calculating the work done in an adiabatic expansion to $(p_2, V_2)$ is then easy:
......@@ -128,6 +152,18 @@ $$
W = -\int_{V_1}^{V_2} \frac{p_1 V_1^\gamma}{V^\gamma} \mathrm{d}V = \frac{p_2 V_2 - p_1 V_1}{\gamma - 1}.
$$
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter14/c14q2.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
(sec:heatengines)=
## Cyclic processes and heat engines
......@@ -171,6 +207,22 @@ $$ (thermosecondlawviolation)
so the amount of heat extracted from the hot bath by the more efficient engine is lower than the amount of heat added (to the hot bath!) by the less efficient engine. As no net work is put into the system, this heat has to come from the cold bath. This setup thus leads to a net spontaneous (because no work is added to the system) flow of heat from the cold to the hot bath, in direct violation of the second law of thermodynamics. Therefore, the efficiencies of the two reversible engines have to be identical.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter15/c15q2.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c15q2_carnotengine.png
:name: fig:c15q2_carnotengine
:width: 400px
```
The fact that the efficiency of all reversible heat engines is the same means that we only need to calculate it once to get a universally valid expression for it. Moreover, we can do the calculation for a case that is designed to make that calculation easy. To that end, we'll use the Carnot cycle ({numref}`fig:thermocycles`b), which consists of two isothermal and two adiabatic processes. As we've seen in the previous section, in an isothermal process the curve in the $pV$ plane is given by $p = N \kB T / V$, and because the change in internal energy depends only on the change in temperature, for an isothermal process the internal energy is constant ($\mathrm{d}U = 0$, so $\mathrm{d}Q = - \mathrm{d}W$). For an adiabatic process, we found $p V^\gamma = \mathrm{const}$, where $\gamma = C_p/C_V$. Since $\gamma > 1$, the line describing an adiabat in the $pV$ plane is steeper than that describing an isotherm, and we can create a cycle.
Calculating the amount of work done and amounts of heat absorbed and extracted in a Carnot cycle is now a simple exercise. For the isothermal process from $(p_1, V_1)$ to $(p_2, V_2)$, we get (combining the ideal gas law, the expression for work in equation&nbsp;{eq}`thermowork`, and the isothermal property that $\mathrm{d}Q = - \mathrm{d}W$)
......@@ -193,6 +245,19 @@ $$ (reversibleengineefficiency)
Irreversible heat engines will necessarily have a lower efficiency (otherwise they could be used to break Carnot's theorem). Practical heat engines, even when run at a close-to-reversible cycle, will also have a lower efficiency, as some of the work produced will necessarily dissipate due to friction.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter14/c14q4.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
(sec:entropy)=
## Entropy
......@@ -202,6 +267,18 @@ We've arrived at last at the mysterious and often ill-understood concept of entr
Then what is entropy? The simplest way to understand it is through a direct analogy with mechanics. In mechanics, the total energy consists of the sum of the kinetic and potential energy, and is conserved, like it is in thermodynamics. Potential energy is nothing but 'the potential to do work' (remember that the potential energy difference between A and B is simply minus the amount of work you need to do to transport something from A to B), and by the work-energy theorem, doing work results in a change of the kinetic energy. In thermodynamics, the entropy is analogous to the potential energy, with one important (historical) difference, namely its sign. While a higher potential energy means you can extract more work from the system, a lower entropy also means you can extract more work from the system. A mechanical system that is left alone will minimize its potential energy; a thermodynamic system that is left alone will maximize its entropy.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter15/c15q1.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
To find a way to calculate the entropy, we return to the Carnot cycle. We found that its efficiency is given by $1-T_\mathrm{c}/T_\mathrm{h}$ (equation&nbsp;{eq}`reversibleengineefficiency`). Comparing with the &nbsp;{eq}`thermodynamicefficiency` of efficiency allows us to read off that $Q_\mathrm{c}/Q_\mathrm{h} = T_\mathrm{c}/T_\mathrm{h}$, or, after rearranging
$$
......@@ -260,6 +337,19 @@ The proof of the Clausius theorem is not difficult (see {numref}`pb:Clausiustheo
A direct consequence of the Clausius theorem is that the entropy in a closed system can never decrease. Considering the universe as a whole, we can also conclude that the entropy of the entire universe can never decrease (but it can, and does, increase over time). These observations are direct consequences of the second law of thermodynamics. Alternatively, one can prove the second law by taking the entropy observations as an axiom, an approach taken in many textbooks. The major downside of that approach is that the law by itself does not tell you what entropy is, resulting in the common confusion about its meaning.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter13/c13q1.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
## Thermodynamic variables
```{index} thermodynamic variables
......@@ -373,6 +463,20 @@ H &= E + pV, \
```
All the free energies defined above are extensive. Note that you cannot define a free energy that is a function of the temperature, pressure, and chemical potential: it would be a function of intensive variables alone, and thus no longer extensive, and therefore be the same for all system sizes.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter15/c15q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
(sec:phasetransitions)=
### Phase transitions and phase coexistence
......@@ -523,6 +627,19 @@ $$ (vdWeos)
where $a$ is a measure of the attraction between the particles, and $b$ the volume excluded by a particle.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter13/c13q2.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
## Problems
```{exercise} A simple heat engine
:label: pb:squarecycleengine
......
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
(ch:fluiddynamics)=
# Fluid dynamics
......@@ -37,6 +49,20 @@ Unlike gases, which you can easily compress, all liquids are nearly *incompressi
Illustration of the hydraulic lever, which exploits Pascal's principle to raise heavy objects with small forces.
```
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter11/c11q5.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
### Archimedes' principle and buoyancy force
```{index} buoyancy force, Archimedes' principle
......@@ -55,6 +81,24 @@ For a floating body the buoyancy force balances the gravitational force, but the
```
Finally, thanks to the buoyancy force, lifting something in water is a lot easier than it is on land, because the buoyancy force helps. We can therefore assign an *apparent weight* to objects in water, equal to their actual weight minus the buoyancy force.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter12/c12q1.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c12q1_meltingice.png
:name: fig:c12q1_meltingice
:width: 300px
```
(sec:surfacetension)=
### Surface tension, wetting angle, and capillary forces
......@@ -150,6 +194,24 @@ $$ (streamlines)
As an example, we consider the two-dimensional flow field $\bm{v} = (v_0/L)(x, -y)$. Equation&nbsp;{eq}`streamlines` then gives $\mathrm{d}x / x = -\mathrm{d}y / y$, which we can integrate to find $y(x) = A/x$, where $A$ is an integration constant. We find a different streamline for every choice of $A$. The vector field corresponding to the flow field and a couple of streamlines are sketched in {numref}`fig:streampathlines`(b).
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter12/c12q2.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c12q2_streamlinesandpathlines.png
:name: fig:c12q2_streamlinesandpathlines
:width: 300px
```
(sec:pathlines)=
### Lagrangian picture: pathlines
......@@ -191,6 +253,22 @@ In addition to the volume flow rate, we can also define the mass flow rate $R_\m
If an incompressible fluid flows through this narrowing pipe, the volume flow per second cannot change. Therefore, in the narrower section of the pipe the fluid's speed must be larger.
```
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter12/c12q4.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c12q4_narrowingpipe.png
:name: fig:c12q4_narrowingpipe
:width: 300px
```
(sec:continuityeq)=
### The equation of continuity*
......@@ -291,6 +369,23 @@ $$ (Bernoulli3)
We therefore see that when streamlines are close together, we get not only high velocity, but also low pressure, otherwise equation&nbsp;{eq}`Bernoulli3` could not be satisfied. Finally, if $p_2 = p_1$, we find that $\frac12 \rho v_1^2 + \rho g z_1 = \frac12 \rho v_2^2 + \rho g z_2$, which is as much as saying that water always finds its way to the lowest point.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter12/c12q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c12q3_pingpongball.png
:name: fig:c12q3_pingpongball
:width: 300px
```
(sec:potentialflow)=
### Potential flows
......
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
(ch:forces)=
# Forces
......@@ -87,6 +99,23 @@ $$ (N3)
```
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter1/c1q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c1q3_pullingforces.png
:name: fig:c1q3_pullingforces
:width: 300px
```
(sec:forcelaws)=
## Force laws
......@@ -105,6 +134,7 @@ Drawing of the cell structure of cork by Hooke, from his 1665 book Micrographia
```
````
(sec:FHooke)=
### Springs: Hooke's law
......@@ -120,6 +150,23 @@ where $\bm{x}$ is now the displacement (from rest) and $k$ is the spring constan
Hooke's law gives us another way to *measure* forces. We have already defined the unit of force using Newton's second law of motion, and we can use that to calibrate a spring, i.e., determine its spring constant, by determining the displacement due to a known force. Once we have $k$, we can simply measure forces by measuring displacements - this is exactly what a spring scale does.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter2/c2q1.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c2q1_hookeslaw.png
:name: fig:c2q1_hookeslaw
:width: 300px
```
(sec:Fgrav)=
### Gravity: Newton's law of gravity
......@@ -169,6 +216,20 @@ $$ (FCoulomb)
where $q_1$ and $q_2$ are the signed magnitudes of the charges, $r$ is again the distance between them, and $k_\mathrm{e} = 8.99 \cdot 10^9\;\mathrm{N} \cdot \mathrm{m}^2/\mathrm{C}^{2}$ is Coulomb's constant. For everyday length and force scales, Coulomb's force is much larger than the force of gravity.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter2/c2q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
(sec:frictiondrag)=
### Friction and drag
......@@ -190,6 +251,18 @@ $$ (Fdraghighspeed)
where $\rho$ is the density of the fluid, $A$ the cross-sectional area of the object, $v$ it's speed, and $c_\mathrm{d}$ it's dimensionless drag coefficient, which depends on the object's shape and surface properties. Typical values for the drag coefficient are $1.0$ for a cyclist, $1.2$ for a running person, $0.48$ for a Volkswagen Beetle, and $0.19$ for a modern aerodynamic car. The direction of the drag force is always opposite to that of the motion.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter2/c2q4.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{index} Coulomb
```
````{admonition} Charles-Augustin de Coulomb (1736-1806)
......@@ -303,6 +376,18 @@ We can find when the stone hits the ground by setting $x(t) = h$ and solving for
````
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter2/c2q5.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
(sec:multipleforces)=
## Multiple forces
......@@ -321,6 +406,22 @@ In the situation described above, things are still simple - you get the net forc
Free body diagram of the forces acting on a book on a slanted table. Gravity always points down, normal forces are always perpendicular to the surface, and frictional forces always parallel to the surface. The force of gravity can be decomposed in directions perpendicular and parallel to the surface as well.
```
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter2/c2q5.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{figure} images/quizes/c2q5_multipleforces.png
:name: fig:c2q5_multipleforces
:width: 300px
```
(sec:statics)=
## Statics
......@@ -383,6 +484,31 @@ Note that the above expressions give the complete answer (magnitude and directio
````
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter3/c3q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter3/c3q4.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
(sec:eomsolutions)=
## Solving the equations of motion in three special cases*
......
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
(ch:planarmotion)=
# General planar motion
......@@ -96,6 +108,20 @@ The Coriolis force causes clockwise and counterclockwise currents around high an
```
A *central force* is a force that points along the (positive or negative) radial direction $\bm{\hat{r}}$, and whose magnitude depends only on the distance $r$ to the origin - so $\bm{F}(\bm{r}) = F(r) \bm{\hat{r}}$. Central forces can be defined in both two and three dimensions, with the three-dimensional concept of the radial distance (to the origin) and direction (direction of increasing $r$) completely analogous to the two-dimensional case. Two important examples of central forces are (general) Newtonian gravity {eq}`FGrav` and the Coulomb force {eq}`FCoulomb` between two charged objects. Although these forces are three-dimensional examples, discussing them here is appropriate, as the following theorem shows.
```{code-cell} ipython3
:tags: ["remove-input"]
import json
from jupyterquiz import display_quiz
with open("./quizes/chapter8/c8q3.json", "r", encoding="utf-8") as f:
questions = json.load(f)
display_quiz(questions, shuffle_answers=False)
```
```{prf:theorem}
:label: thm:motionundercentralforce
The motion of a particle under the action of a central force takes place in a plane.
......
content/images/quizes/c10q3_boundaries.png

50.9 KiB

content/images/quizes/c10q4_interference.png

103 KiB

content/images/quizes/c11q1_phasechanges.png

191 KiB

content/images/quizes/c11q2_elasticdeformations.png

213 KiB

content/images/quizes/c12q1_meltingice.png

102 KiB

content/images/quizes/c12q2_streamlinesandpathlines.png

154 KiB

content/images/quizes/c12q3_pingpongball.png

23.9 KiB

content/images/quizes/c12q4_narrowingpipe.png

146 KiB

content/images/quizes/c13q3_molecules.png

64.1 KiB

content/images/quizes/c15q2_carnotengine.png

206 KiB

content/images/quizes/c1q3_pullingforces.png

601 KiB

content/images/quizes/c2q1_hookeslaw.png

123 KiB

content/images/quizes/c2q5_multipleforces.png

148 KiB

content/images/quizes/c3q1_centerofmass.png

77.7 KiB

content/images/quizes/c3q2_centerofmass.png

326 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment