Comparison with analytic solution The analytic solution for free-fall with v²-dependent air drag is: 2m DpA Yanalyt (t) = yo + In cosh ( Vanalyt (t) = In [ ]: # Analytic solution 2mg DpA tanh Dp Ag 2m DpAg 2m t Exercise 2: Write code for the analytic velocity solution In the code cell below, we already implemented the equation for y_analyt. Add the equation for the velocity, storing the result in v_analyt. The hyperbolic tangent function is available as np. tanh. For the time t, use the vector time that we populated in the loop above. Note: If your code generates any error message (in red), you need to fix this error before continuing. Get help from your instructor or classmates if needed. You will need to use some parentheses () for the trigonometric and square root functions, and to enforce the order of operations. However, use them only where necessary; an excessive number of parentheses makes it harder to debug your code. y_analyt = y0 + 2*m/(D*rho*A) * np.log(np.cosh (np.sqrt (D*rho*A*g/(2*m))*time)) # YOUR CODE HERE raise NotImplementedError()

icon
Related questions
Question
**Comparison with Analytic Solution**

The analytic solution for free-fall with \( v^2 \)-dependent air drag is:

\[ y_{\text{analyt}}(t) = y_0 + \frac{2m}{D\rho A} \left[ \cosh \left( \sqrt{\frac{D\rho Ag}{2m}} \, t \right) \right] \]

\[ v_{\text{analyt}}(t) = \sqrt{\frac{2mg}{D\rho A}} \, \tanh \left( \sqrt{\frac{D\rho Ag}{2m}} \, t \right) \]

---

**Exercise 2: Write code for the analytic velocity solution**

In the code cell below, we already implemented the equation for \( y_{\text{analyt}} \). Add the equation for the velocity, storing the result in `v_analyt`. The hyperbolic tangent function is available as `np.tanh`. For the time \( t \), use the vector `time` that we populated in the loop above.

**Note:** If your code generates any error message (in red), you need to fix this error before continuing. Get help from your instructor or classmates if needed. You will need to use some parentheses `()` for the trigonometric and square root functions, and to enforce the order of operations. However, use them only where necessary; an excessive number of parentheses makes it harder to debug your code.

```python
# Analytic solution
y_analyt = y0 + 2*m/(D*rho*A) * np.log(np.cosh(np.sqrt(D*rho*A*g/(2*m))*time))
# YOUR CODE HERE
raise NotImplementedError()
```
Transcribed Image Text:**Comparison with Analytic Solution** The analytic solution for free-fall with \( v^2 \)-dependent air drag is: \[ y_{\text{analyt}}(t) = y_0 + \frac{2m}{D\rho A} \left[ \cosh \left( \sqrt{\frac{D\rho Ag}{2m}} \, t \right) \right] \] \[ v_{\text{analyt}}(t) = \sqrt{\frac{2mg}{D\rho A}} \, \tanh \left( \sqrt{\frac{D\rho Ag}{2m}} \, t \right) \] --- **Exercise 2: Write code for the analytic velocity solution** In the code cell below, we already implemented the equation for \( y_{\text{analyt}} \). Add the equation for the velocity, storing the result in `v_analyt`. The hyperbolic tangent function is available as `np.tanh`. For the time \( t \), use the vector `time` that we populated in the loop above. **Note:** If your code generates any error message (in red), you need to fix this error before continuing. Get help from your instructor or classmates if needed. You will need to use some parentheses `()` for the trigonometric and square root functions, and to enforce the order of operations. However, use them only where necessary; an excessive number of parentheses makes it harder to debug your code. ```python # Analytic solution y_analyt = y0 + 2*m/(D*rho*A) * np.log(np.cosh(np.sqrt(D*rho*A*g/(2*m))*time)) # YOUR CODE HERE raise NotImplementedError() ```
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer