# Taylor problem 2.40

Consider an object that is coasting horizontally (positive $x$ direction) subject to a drag force $f = -bv -c v^2$.  Your first job is to solve Newton's 2nd law equation for $v(t)$ by separating variables.  You should find:

$\begin{align}
  v(t) &= \frac{b A e^{-bt/m}}{1 - c A e^{-bt/m}} \\
  A &\equiv \frac{v_0}{b + c v_0}
\end{align}$

Now we want to plot $v(t)$ as analyze the behavior for large $t$.

**Go through and fill in the blanks where ### appears.**


```python
import numpy as np

def v_of_t(t, b, c, v0, m=1):
    A = v0/(b + c*v0)
    return   ### fill in the equation here
```

Next we make a plot in the standard way:


```python
%matplotlib inline
import matplotlib.pyplot as plt

t_pts =  ### determine a set of t points such that you see the decay
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(t_pts, v_of_t(t_pts, 1., 1., 1.))
ax.set_xlabel(r'$t$')
ax.set_ylabel(r'$v(t)$')

```

Now we add another plot and check if it is an exponential decay.  **What kind of plot is this?  (Google the name along with 'matplotlib'.)**


```python
%matplotlib inline
import matplotlib.pyplot as plt

plt.rcParams.update({'font.size': 18})

t_pts = np.arange(0., 3., 0.1)
fig = plt.figure(figsize=(10,5))
ax = fig.add_subplot(1,2,1)
ax.plot(t_pts, v_of_t(t_pts, 1., 1., 1.))
ax.set_xlabel(r'$t$')
ax.set_ylabel(r'$v(t)$')
ax.grid(True)

ax2 = fig.add_subplot(1,2,2)
ax2.semilogy(t_pts, v_of_t(t_pts, 1., 1., 1.))
ax2.set_xlabel(r'$t$')
ax2.set_ylabel(r'$v(t)$')
ax2.grid(True)

fig.tight_layout()  # make the spacing of subplots nicer

```


```python
fig.savefig('Taylor_prob_2.40.png', bbox_inches='tight')
### Find the figure file and display it in your browser, then save or print. 
### What do you learn from the second graph?
```


```python

```

58106d8e50837422e04be66a0dbde2e6820c16d7
ipynb
Jupyter Notebook
2020_week_1/Taylor_problem_2.40_template.ipynb
furnstahl/5300-notebooks
c3551bf2d8de22dec11d9035aa1ea78de1355cad
MIT
2019-12-16T22:01:54.000Z
2020-12-11T18:07:58.000Z
2020_week_1/Taylor_problem_2.40_template.ipynb
furnstahl/5300-notebooks
c3551bf2d8de22dec11d9035aa1ea78de1355cad
MIT
2020_week_1/Taylor_problem_2.40_template.ipynb
furnstahl/5300-notebooks
c3551bf2d8de22dec11d9035aa1ea78de1355cad
MIT
2019-01-28T19:01:02.000Z
2021-04-15T22:45:23.000Z
Qwen/Qwen-72B
1. YES
2. YES