To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 1c9ce7ea authored by bentelk's avatar bentelk
Browse files

Typo corrections and minor updates in the explanations

parent 865fd726
%% Cell type:markdown id:d8d8abfa tags:
 
## Animate a bouncing ball
 
Solve the equations of motion for the position and velocity of a ball as a function of time.
Change in position $x$ and velocity $v$ over the time interval $\Delta t$ are
Changes in position $x$, $y$ and velocity $v$ over the time interval $\Delta t$ are
$$
\Delta x = v \cdot \Delta t \\
\Delta v = a \cdot \Delta t
\Delta x = v_x \cdot \Delta t \\
\Delta y = v_y \cdot \Delta t \\
\Delta v_y = a \cdot \Delta t
$$
 
With only gravitational acceleration acting we have $a = g = 9.81 \text{m}/\text{s}^2$
Assume $v_x$ is constant and only gravitational acceleration is acting, i.e. $a = g = 9.81 \text{m}/\text{s}^2$. If position $y < 0$ the ball bounces with a coefficient of $coe_b = 0.7$.
 
 
Let $x_1$ and $v_1$ be the initial position and velocity and $x_2$ and $v_2$ denote the position and velocity after the time interval $Δt$. We can use the above equations, and $Δx=x_2−x_1$, $Δv=v_2−v_1$, to solve for $x_2$ and $v_2$.
Let $x_1$, $y_1$ and $v_{x1}$, $v_{y1}$ be the initial position and velocity and $x_2$, $y_2$ and $v_{x2}$, $v_{y2}$ denote the position and velocity after the time interval $Δt$. With the above equations and $Δx=x_2−x_1$, $Δy=y_2−y_1$, $Δv=v_2−v_1$, $v_x = constant$, solve for $x_2$, $y_2$ and $v_2$ (dropping the index $y$ from now on, i.e. $v_y = v$, as $v_x = v_{x0}$ = const).
$$
x_2=x_1+v_1Δt \\
x_2=x_1+v_{x0}Δt \\
y_2=y_1+v_1Δt \\
v_2=v_1+aΔt
$$
if $y < 0$ the ball bounces:
$$
y_i = 0\\
v_i = -v_{i-1} * coe_b
$$
<b> *Note:* </b> Be patient as the animation takes a few seconds to display!
 
%% Cell type:code id:82d33286-b367-4ef1-ad76-b198a8f435df tags:
 
``` python
import numpy as np
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment