Skip to article frontmatterSkip to article content

3.8Examples, exercises and solutions

3.8.1Exercise set 1ยถ

Source
import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as widgets
from ipywidgets import interact

# --- Parameters ---
x0 = 0.0
t_stop = 2.0
dt = 0.02
t = np.arange(0, t_stop + dt, dt)

def run_animation(v0, F, m):
    # --- Derived motion ---
    x = x0 + v0 * t + 0.5 * F / m * t**2
    v = v0 + F / m * t
    E_kin = 0.5 * m * v**2
    W = F * (x - x0)

    # --- Plot setup ---
    plt.clf()
    
    fig, axs = plt.subplots(2, 1, figsize=(15, 10))
    
    ax_position = axs[0]
    ax_ekin = axs[1]

    ax_position.plot(t,x,'k-')
    ax_position.set_xlim(0, t_stop)
    ax_position.set_ylim(min(x)-1, max(x)+1)
    ax_position.set_title("Position vs Time")
    ax_position.set_ylabel('$x$(m)')

    ax_ekin.plot(t,E_kin,'k-',label='$E_{kin}$')
    ax_ekin.plot(t,W,'r-',label='$W$')
    ax_ekin.set_xlim(0, t_stop)
    ax_ekin.set_ylim(0, max(E_kin)*1.1)
    ax_ekin.set_title("Kinetic Energy vs Time")
    ax_ekin.set_ylabel('$E$(J)')
    

    
# --- Interact control panel ---
interact(run_animation,
         v0=widgets.FloatSlider(min=0, max=10, step=0.5, value=5.0, description="vโ‚€ (m/s)"),
         F=widgets.FloatSlider(min=-5, max=5, step=0.5, value=6.5, description="F (N)"),
         m=widgets.FloatSlider(min=0.5, max=5.0, step=0.1, value=1.0, description="m (kg)"))
Loading...

3.8.2Answers set 1ยถ

Solution to Exerciseย 1

a. Show โˆ‡โƒ—ร—mgโƒ—=0 \vec{\nabla} \times m\vec{g} = 0
โˆ‡โƒ—ร—mgโƒ—=0 \vec{\nabla} \times m\vec{g} = 0 ? How to compute it? For Cartesian coordinates there is an easy to remember rule:

โˆ‡โƒ—ร—Fโƒ—=โˆฃx^y^z^โˆ‚โˆ‚xโˆ‚โˆ‚yโˆ‚โˆ‚zFxFyFzโˆฃ\vec{\nabla} \times \vec{F} = \begin{vmatrix}\hat{x}&\hat{y}&\hat{z}\\\frac{\partial}{\partial x}&\frac{\partial}{\partial y}&\frac{\partial}{\partial z}\\F_x&F_y&F_z\end{vmatrix}

If we chose our coordinates such that gโƒ—=โˆ’gz^ \vec{g} = -g \hat{z} we get:

โˆ‡โƒ—ร—Fโƒ—g=โˆฃx^y^z^โˆ‚โˆ‚xโˆ‚โˆ‚yโˆ‚โˆ‚z00โˆ’mgโˆฃ=0\vec{\nabla} \times \vec{F}_g = \begin{vmatrix}\hat{x}&\hat{y}&\hat{z}\\\frac{\partial}{\partial x}&\frac{\partial}{\partial y}&\frac{\partial}{\partial z}\\0&0& -mg\end{vmatrix} = 0

Thus Fโƒ—g \vec{F}_g is conservative.

b. Find a VV that satisfies โˆ’mgโƒ—=โˆ’โˆ‡โƒ—V -m\vec{g} = -\vec{\nabla} V
Does โˆ’mgโƒ—=โˆ’โˆ‡โƒ—V -m\vec{g} = -\vec{\nabla} V have a solution for V? Letโ€™s try, using the same coordinates as above.

โˆ’โˆ‡โƒ—V=โˆ’mgโƒ—โ‡’โˆ‚Vโˆ‚x=0โ†’V(x,y,z)=f(y,z)โˆ‚Vโˆ‚y=0โ†’V(x,y,z)=g(x,z)โˆ‚Vโˆ‚z=mgโ†’V(x,y,z)=mgz+h(x,y)\begin{split} -\vec{\nabla}V &= - m\vec{g} \Rightarrow \\ \frac{\partial V}{\partial x} &= 0 \rightarrow V(x,y,z) = f(y,z) \\ \frac{\partial V}{\partial y} &= 0 \rightarrow V(x,y,z) = g(x,z) \\ \frac{\partial V}{\partial z} &= mg \rightarrow V(x,y,z) = mgz + h(x,y) \end{split}

f,g,h are unknown functions. But all we need to do, is find one VV that satisfies โˆ’mgโƒ—=โˆ’โˆ‡โƒ—V -m\vec{g} = -\vec{\nabla} V .

So, if we take V(x,y,z)=mgz V(x,y,z) = mgz we have shown, that gravity in this form is conservative and that we can take V(x,y,z)=mgz V(x,y,z) = mgz for its corresponding potential energy.

By the way: from the first part (curl F = 0), we know that the force is conservative and we know that we could try to find V from

V(x,y,z)=โˆ’โˆซrefmgโƒ—โ‹…drโƒ—=โˆซrefmgz^โ‹…drโƒ—=โˆซrefmgdz=mgz+const\begin{split} V(x,y,z) &= -\int_{ref} m\vec{g} \cdot d\vec{r} = \int_{ref} mg \hat{z} \cdot d\vec{r} \\ &= \int_{ref} mg dz = mgz + const \end{split}
Solution to Exerciseย 3

Click for the solution Friction Not Conservative.

Solution to Exerciseย 4

Click for the solution Conservative Force.

Solution to Exerciseย 5

Click for the solution Non-Conservative Force.

Solution to Exerciseย 6

Click for the solution Potential energy & Force.

Solution to Exerciseย 7

Click for the solution Force Field.

Solution to Exerciseย 8

Click for the solution Sinusoidal Force Field.

3.8.3Exercise set 2ยถ

Source
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML

#  Inputs 
x0 = float(input('Initial position (m) from 0 to 10'))        # Initial position (m)
v0 = float(input('Initial velocity (m/s) from -10 to 10'))        # Initial velocity (m/s)
k = float(input('Spring constant (N/m) from 0.1 to 1'))       # Spring constant (N/m)
m = 2.0        # Mass (kg)

#  Derived 
omega = np.sqrt(k / m)
t_stop = 4.0
dt = 0.02
t_values = np.arange(0, t_stop, dt)

#  Analytical solution for x(t) 
C1 = 0.5 * x0 + 0.5 * v0 / omega
C2 = 0.5 * x0 - 0.5 * v0 / omega
x = C1 * np.exp(omega * t_values) + C2 * np.exp(-omega * t_values)

# Velocity is not needed directly as E_kin = total energy - work (from energy conservation)
W = 0.5 * k * (x**2 - x0**2)
v_squared = v0**2 + 2 * W / m
E_kin = 0.5 * m * v_squared

#  Plot setup 
fig, axs = plt.subplots(2, 2, figsize=(10, 10))
ax_block = axs[0, 0]
ax_pos = axs[1, 0]
ax_ekin = axs[0, 1]
ax_work = axs[1, 1]

# Set axis limits
ax_block.set_xlim(min(x)-1, max(x)+1)
ax_block.set_ylim(-1, 1)
ax_block.set_title("Block motion")
ax_block.set_yticks([])
ax_block.axhline(y=-0.06, color='black', linewidth=5)

ax_pos.set_xlim(0, t_stop)
ax_pos.set_ylim(min(x)-1, max(x)+1)
ax_pos.set_title("Position vs Time")

ax_ekin.set_xlim(0, t_stop)
ax_ekin.set_ylim(0, max(E_kin)*1.1)
ax_ekin.set_title("Kinetic Energy vs Time")

ax_work.set_xlim(0, t_stop)
ax_work.set_ylim(min(W)*1.1, max(W)*1.1)
ax_work.set_title("Work vs Time")

# Artists
block_dot, = ax_block.plot([], [], 'rs', markersize=10)
line_pos, = ax_pos.plot([], [], 'b')
line_ekin, = ax_ekin.plot([], [], 'g')
line_work, = ax_work.plot([], [], 'r')

#  Init 
def init():
    block_dot.set_data([], [])
    line_pos.set_data([], [])
    line_ekin.set_data([], [])
    line_work.set_data([], [])
    return block_dot, line_pos, line_ekin, line_work

#  Update function 
def update(frame):
    t = t_values[:frame]
    block_dot.set_data([x[frame]], [0])
    line_pos.set_data(t, x[:frame])
    line_ekin.set_data(t, E_kin[:frame])
    line_work.set_data(t, W[:frame])
    return block_dot, line_pos, line_ekin, line_work

#  Animation 
ani = FuncAnimation(fig, update, frames=len(t_values),
                    init_func=init, interval=dt*1000, blit=True)

plt.close(fig)  # Prevent double static plot
HTML(ani.to_jshtml())

3.8.4Answers set 2ยถ

Solution to Exerciseย 9
  1. W=ฮ”Ekin=โˆซ0xFdx=โˆซ0xkxdx=1/2kx2=1/2mv2โ‡’v=kx2mW=\Delta E_{kin} = \int_0^x F \mathrm{d}x = \int_0^x k x dx = 1/2kx^2 = 1/2mv^2 \Rightarrow v = \sqrt{\frac{kx^2}{m}}
  2. The spring has mass as well.
  3. The gravitational does work as well (W=Fgdx<0W=F_g\mathrm{d}x \lt 0)
Solution to Exerciseย 13
Solution to Exerciseย 15

Work done by electric field when the electron moves from x=14Lx=\frac{1}{4}L to x=0x=0:

W=โˆซ14L0Fโƒ—ย .dsโƒ—=โˆ’eE0โˆซ14L0sinโก(2ฯ€xL)dx=โˆ’eE0L2ฯ€[โˆ’cosโก(2ฯ€xL)]14L0=12ฯ€eE0LW=\int_{\frac{1}{4}L}^{0}{\vec{F}\ .d\vec{s}}=-eE_0\int_{\frac{1}{4}L}^{0}{\sin\left(2\pi\frac{x}{L}\right)dx=\\ -eE_0\frac{L}{2\pi}}\left[-\cos\left(2\pi\frac{x}{L}\right)\right]_{\frac{1}{4}L}^0=\frac{1}{2\pi}eE_0L

Work done is gain in kinetic energy: ฮ”Ekin=W\Delta E_{kin}=W. Assuming the only work done is by the electric field and using initial velocity is zero: vi=0v_i=0 :

12mv2=ย 12ฯ€eE0Lโ‡’v=ย eE0Lฯ€m\frac{1}{2}mv^2=\ \frac{1}{2\pi}eE_0L\Rightarrow v=\ \sqrt{\frac{eE_0L}{\pi m}}

Note that indeed the work done is positive, as it should in this case since the electron starts with zero velocity.

Solution to Exerciseย 16
W=โˆซ0LFโƒ—ย .dsโƒ—=โˆซ0LF0eโˆ’tฯ„ย dxW=\int_{0}^{L}{\vec{F}\ .d\vec{s}}=\int_{0}^{L}{F_0e^{-\frac{t}{\tau}}\ dx}

Particle velocity is v0=const.v_0=const. Thus, trajectory x(t)=v0tx\left(t\right)=v_0t since at t=0โ†’x=0t=0\rightarrow x=0 Consequently: x=Lโ†’t=ย Lv0x=L\rightarrow t=\ \frac{L}{v_0}

Thus, we can write for the amount of work done:

W=โˆซ0Lv0F0eโˆ’tฯ„โ‹…v0dt=F0v0[โˆ’ฯ„eโˆ’tฯ„]0L/v0=F0v0ฯ„(1โˆ’eโˆ’Lv0ฯ„)W=\int_{0}^{\frac{L}{v_0}}{F_0e^{-\frac{t}{\tau}}\cdot v_0dt}=\\ F_0v_0\left[-\tau e^{-\frac{t}{\tau}}\right]_0^{L/v_0}=F_0v_0\tau\left(1-e^{-\frac{L}{v_0\tau}}\right)

We note: W>0W>0 and naively, we could expect that the kinetic energy of the particle would have increased. But that isnโ€™t the case: it started with Ekin=12mv02E_{kin}= \frac{1}{2}mv_0^2 and it kept this along the entire path as it is given that the particle is traveling with a constant velocity.

From this last statement, we immediately learn, that there must be a second force acting on the particle. This force is exactly equal and opposite to FF at all times! Otherwise, the particle would accelerate and change its velocity. Consequently, this second force also perform work on mm, the amount is exactly โˆ’W-W and thus the total work done on the particle is zero which reflects that the particle does not change its kinetic energy.

Footnotesยถ
  1. Exercise from Idema, T. (2023). Introduction to particle and continuum mechanics. Idema (2023)

Referencesยถ
  1. Idema, T. (2023). Introduction to particle and continuum mechanics. TU Delft OPEN Publishing. 10.59490/tb.81