```python
from IPython.core.display import Math
import sympy as sym
from sympy.interactive import printing
printing.init_printing()

```


```python
#F,m,a,g,x,y, Vx, Vy, t = sym.symbols('F m a g x y t')
#F = a*m
```


```python
#import sys
from IPython.core.display import Math
from sympy import symbols, latex, cos, sin
#from prettyPy import prettyPy as pp
display(Math(latex('\\mathbf{F=m*a}') ))
display(Math(latex('\\mathbf{F_{g}=-m*g} ') ))
display(Math(latex('\\mathbf{F_{g}= F_{x}+F_{y}} = 0 + {(-g)}') ))
display(Math(r'{F_x=}\frac{d^2x}{dt^2} = 0 '))
display(Math(r'{F_y=}\frac{d^2y}{dt^2} = -g'))
display(Math(latex('\\mathbf{Vx_{0}=}'r'\frac{dx}{dt}') ))
display(Math(latex('\\mathbf{V_{x0}t+}'r'{x_{0}}={x_{t}}' ) ))
display(Math(r'{-g=}\frac{d^2y}{dt^2}'))
display(Math(r'{-gt+V_{y0}t=}\frac{dy}{dt}'))
display(Math(r'$\frac{-g}{2}{t^2}+V_{y0}t+{y_0 =} y_t$'))
display(Math(r'${x_0 =} {y_0 = 0}$'))
display(Math(latex('\\mathbf{x_{t}}={V_{x0}t}' ) ))
display(Math(r'${y_t}=\frac{-g}{2}{t^2}+V_{y0}t $'))
```


$$\mathbf{F=m*a}$$



$$\mathbf{F_{g}=-m*g} $$



$$\mathbf{F_{g}= F_{x}+F_{y}} = 0 + {(-g)}$$



$${F_x=}\frac{d^2x}{dt^2} = 0 $$



$${F_y=}\frac{d^2y}{dt^2} = -g$$



$$\mathbf{Vx_{0}=}\frac{dx}{dt}$$



$$\mathbf{V_{x0}t+}{x_{0}}={x_{t}}$$



$${-g=}\frac{d^2y}{dt^2}$$



$${-gt+V_{y0}t=}\frac{dy}{dt}$$



$$\frac{-g}{2}{t^2}+V_{y0}t+{y_0 =} y_t$$



$${x_0 =} {y_0 = 0}$$



$$\mathbf{x_{t}}={V_{x0}t}$$



$${y_t}=\frac{-g}{2}{t^2}+V_{y0}t $$



```python
import matplotlib.pyplot as plt
import numpy as np
```


```python
m = 0.43 # [kg]
x0 = 0  #[m]
y0 = 0  #[m]
vx0 = 15*np.sqrt(3) #[m/s]
vy0 = 15 # [m/s]
g = 9.81 # [m/s^2]
display(Math(latex('\\mathbf{Vx_{0}=30*cos(30)}') ))
display(Math(latex('\\mathbf{Vx_{0}=}'r'\frac{30}{2}' r'\sqrt{3}=' r'15\sqrt{3} {  m/s}') ))
display(Math(latex('\\mathbf{Vy_{0}=30*sin(30)} ') ))
display(Math(latex('\\mathbf{Vy_{0}=}'r'\frac{30}{2}='  r'{15 m/s}') ))


```


$$\mathbf{Vx_{0}=30*cos(30)}$$



$$\mathbf{Vx_{0}=}\frac{30}{2}\sqrt{3}=15\sqrt{3} {  m/s}$$



$$\mathbf{Vy_{0}=30*sin(30)} $$



$$\mathbf{Vy_{0}=}\frac{30}{2}={15 m/s}$$



```python
dt = 0.001 #[s]
%matplotlib notebook
t = np.arange(0, 3.05, dt)
plt.figure()
plt.plot(vx0*t, -g/2*t**2+vy0*t)
plt.xlim(0,80)
plt.ylim(0,12)
plt.grid()
plt.show()
plt.title(' Exercício 1')
plt.xlabel('x (m)', size = 20)
plt.ylabel('y (m)', size = 20)
```


    <IPython.core.display.Javascript object>









    Text(0,0.5,'y (m)')




```python
display(Math(r'\frac{dvx}{dt} = 0 '))
display(Math(r'$\frac{dx}{dt} = Vx_t'))
display(Math(r'\frac{dvy}{dt} = -g '))
display(Math(r'$\frac{dy}{dt} = Vy_t'))
display(Math(r'$\frac{dx}{dt}= \lim_{\Delta t \to 0} \frac{x(t+\Delta t) -x(t)}{\Delta t}$'))
display(Math(r'$\frac{dx}{dt}  \approx \frac{x(t+\Delta t) -x(t)}{\Delta t} \to x(t+\Delta t) \approx x(t) + \Delta t \frac{dx}{dt}$'))
```


$$\frac{dvx}{dt} = 0 $$



$$\frac{dx}{dt} = Vx_t$$



$$\frac{dvy}{dt} = -g $$



$$\frac{dy}{dt} = Vy_t$$



$$\frac{dx}{dt}= \lim_{\Delta t \to 0} \frac{x(t+\Delta t) -x(t)}{\Delta t}$$



$$\frac{dx}{dt}  \approx \frac{x(t+\Delta t) -x(t)}{\Delta t} \to x(t+\Delta t) \approx x(t) + \Delta t \frac{dx}{dt}$$



```python
x = x0
y = y0
vx = vx0
vy = vy0
r = np.array([x,y])
while y >= 0:
    dxdt = vx
    x = x + dt * dxdt
    dydt = vy
    y = y + dt * dydt
    dvxdt = 0
    vx = vx + dt * dvxdt
    dvydt = -g
    vy = vy + dt * dvydt
    r = np.vstack((r, np.array([x,y])))
```


```python
plt.figure()
plt.plot(r[:,0],r[:,1])
plt.xlim(0,80)
plt.ylim(0,12)
plt.grid()
plt.show()
plt.title(' Exercício 2')
plt.xlabel('x (m)', size = 20)
plt.ylabel('y (m)', size = 20)
plt.show()
```


    <IPython.core.display.Javascript object>







```python
display(Math(r'$\frac{d^2x}{dt^2} = 0 ' r'          ;\frac{dy}{dt} = -g '  r'    ;\frac{dvx}{dt} = 0 '))
display(Math(r'x_t=x(t-dt)+ dt*dx/dt') )
display(Math(r'$\frac{d^2x}{dt^2} = 0 ' r'          ;\frac{dy}{dt} = -g '  r'    ;\frac{dvx}{dt} = 0 '))
display(Math(r'$\frac{dx}{dt} = Vx'  r'             ;\frac{dy}{dt} = Vy'))
display(Math(r'$\frac{dy}{dt}$'))
```


$$\frac{d^2x}{dt^2} = 0           ;\frac{dy}{dt} = -g     ;\frac{dvx}{dt} = 0 $$



$$x_t=x(t-dt)+ dt*dx/dt$$



$$\frac{d^2x}{dt^2} = 0           ;\frac{dy}{dt} = -g     ;\frac{dvx}{dt} = 0 $$



$$\frac{dx}{dt} = Vx             ;\frac{dy}{dt} = Vy$$



$$\frac{dy}{dt}$$



```python
from IPython.display import Image
Image("C:\\2tri2018\\Ex2.png")
```


```python
display(Math(r'{\lambda^2}+\frac{b}{m}\lambda = 0 '))
```


$${\lambda^2}+\frac{b}{m}\lambda = 0 $$



```python
display(Math(r'{raizes \ \lambda=0} \ e \ {\ \lambda=\frac{-b}{m}}'))
```


$${raizes \ \lambda=0} \ e \ {\ \lambda=\frac{-b}{m}}$$



```python
display(Math(r'{x_{n1}t = Ae^{0t} = A}'))
display(Math(r'{x_{n2}t = Be^{\frac{-b}{m}t}}'))
```


$${x_{n1}t = Ae^{0t} = A}$$



$${x_{n2}t = Be^{\frac{-b}{m}t}}$$



```python
display(Math(r'{x(t) =A+ Be^{\frac{-b}{m}t}}'))
```


$${x(t) =A+ Be^{\frac{-b}{m}t}}$$



```python
display(Math(r'{x_0 =A+ B = 0}'))
```


$${x_0 =A+ B = 0}$$



```python
display(Math(r'{vx_0 =\frac{dx_0}{dt}=\frac{-Bb}{m}e^{\frac{-b}{m}0}}'))
display(Math(r'{B=\frac{-vx_0m}{b} \to {A=\frac{vx_0m}{b}}}'))
```


$${vx_0 =\frac{dx_0}{dt}=\frac{-Bb}{m}e^{\frac{-b}{m}0}}$$



$${B=\frac{-vx_0m}{b} \to {A=\frac{vx_0m}{b}}}$$



```python
display(Math(r'{x(t) =\frac{vx_0m}{b}-\frac{vx_0m}{b} e^{\frac{-b}{m}t}}'))
```


$${x(t) =\frac{vx_0m}{b}-\frac{vx_0m}{b} e^{\frac{-b}{m}t}}$$



```python
display(Math(r'{x(t) =\frac{vx_0m}{b}(1 -e^{\frac{-b}{m}t})}'))
```


$${x(t) =\frac{vx_0m}{b}(1 -e^{\frac{-b}{m}t})}$$



```python
display(Math(r'$\frac{d^2y}{dt^2} = -\frac{b}{m} \frac{dy}{dt}'))
```


$$\frac{d^2y}{dt^2} = -\frac{b}{m} \frac{dy}{dt}$$



```python
display(Math(r'{y_n(t) =A+ Be^{-\frac{b}{m}t}}'))
display(Math(r'$\frac{d^2y}{dt^2} = -\frac{b}{m} \frac{dy_t}{dt} -g'))
display(Math(r'$\frac{dy_t}{dt}= -\frac{mg}{b}'))
display(Math(r'$y(t)= A+B-\frac{mg}{b}t'))
```


$${y_n(t) =A+ Be^{-\frac{b}{m}t}}$$



$$\frac{d^2y}{dt^2} = -\frac{b}{m} \frac{dy_t}{dt} -g$$



$$\frac{dy_t}{dt}= -\frac{mg}{b}$$



$$y(t)= A+B-\frac{mg}{b}t$$



```python
display(Math(r'{y(t) =A+ Be^{-\frac{b}{m}t}}-\frac{mg}{b}t'))
```


$${y(t) =A+ Be^{-\frac{b}{m}t}}-\frac{mg}{b}t$$



```python
display(Math(r'{y_0 =A+ B = 0}'))
```


$${y_0 =A+ B = 0}$$



```python
display(Math(r'{vy_0 =\frac{dy_0}{dt}=\frac{-Bb}{m}-{\frac{-mg}{b}}}'))
display(Math(r'{B=-\frac{m^2g}{b^2} - \frac{vy_0m}{b}}'))
display(Math(r'{A=\frac{m^2g}{b^2} +\frac{vy_0m}{b}}'))
```


$${vy_0 =\frac{dy_0}{dt}=\frac{-Bb}{m}-{\frac{-mg}{b}}}$$



$${B=-\frac{m^2g}{b^2} - \frac{vy_0m}{b}}$$



$${A=\frac{m^2g}{b^2} +\frac{vy_0m}{b}}$$



```python
display(Math(r'{y(t) =(\frac{m^2g}{b^2} +\frac{vy_0m}{b})+ (-\frac{m^2g}{b^2} - \frac{vy_0m}{b})e^{-\frac{b}{m}t}}-\frac{mg}{b}t'))
display(Math(r'{y(t) =(\frac{m^2g}{b^2} +\frac{vy_0m}{b}) (1 - e^{-\frac{b}{m}t})}-\frac{mg}{b}t'))
```


$${y(t) =(\frac{m^2g}{b^2} +\frac{vy_0m}{b})+ (-\frac{m^2g}{b^2} - \frac{vy_0m}{b})e^{-\frac{b}{m}t}}-\frac{mg}{b}t$$



$${y(t) =(\frac{m^2g}{b^2} +\frac{vy_0m}{b}) (1 - e^{-\frac{b}{m}t})}-\frac{mg}{b}t$$



```python
b = 0.006 # [Ns/m]
t = np.arange(0, 3.05, 0.01)
plt.figure()
plt.plot(vx0*m/b*(1-np.exp(-b/m*t)), 
         (vy0*m/b+g*m**2/b**2)*(1-np.exp(-b/m*t)) - g*m/b*t)
plt.xlim(0,80)
plt.ylim(0,12)
plt.title(' Exercício 3 - Analítico')
plt.xlabel('x (m)', size = 20)
plt.ylabel('y (m)', size = 20)
plt.grid()
plt.show()
```


    <IPython.core.display.Javascript object>







```python
display(Math(r'$\frac{d^2x}{dt^2} = -\frac{b}{m} \frac{dx}{dt}'))
display(Math(r'$\frac{d^2y}{dt^2} = -\frac{b}{m} \frac{dy}{dt}-g'))

```


$$\frac{d^2x}{dt^2} = -\frac{b}{m} \frac{dx}{dt}$$



$$\frac{d^2y}{dt^2} = -\frac{b}{m} \frac{dy}{dt}-g$$



```python
display(Math(r'$\frac{dv_x}{dt} = -\frac{b}{m} v_x'))
display(Math(r'$\frac{dx}{dt} =  v_x'))
display(Math(r'$\frac{dv_y}{dt} = -\frac{b}{m} v_y - g'))
display(Math(r'$\frac{dv}{dt} =  v_y'))
display(Math(r'$\frac{dx}{dt}  \approx \frac{x(t+\Delta t) -x(t)}{\Delta t} \to x(t+\Delta t) \approx x(t) + \Delta t \frac{dx}{dt}$'))
```


$$\frac{dv_x}{dt} = -\frac{b}{m} v_x$$



$$\frac{dx}{dt} =  v_x$$



$$\frac{dv_y}{dt} = -\frac{b}{m} v_y - g$$



$$\frac{dv}{dt} =  v_y$$



$$\frac{dx}{dt}  \approx \frac{x(t+\Delta t) -x(t)}{\Delta t} \to x(t+\Delta t) \approx x(t) + \Delta t \frac{dx}{dt}$$



```python
#m = 0.43 # [kg]
#x0 = 0  #[m]
#y0 = 0  #[m]
#vx0 = 15*np.sqrt(3) #[m/s]
#vy0 = 15 # [m/s]
#g = 9.81 # [m/s^2]
#dt = 0.001 #[s]
#%matplotlib notebook
#t = np.arange(0, 3.05, dt)
x = x0
y = y0
vx = vx0
vy = vy0
r = np.array([x,y])
while y >= 0:
    dxdt = vx
    x = x + dt * dxdt
    dydt = vy
    y = y + dt * dydt
    dvxdt = -b/m*vx
    vx = vx + dt * dvxdt
    dvydt = -g - b/m*vy
    vy = vy + dt * dvydt
    r = np.vstack((r, np.array([x,y])))
```


```python
plt.figure()
plt.plot(r[:,0],r[:,1])
plt.xlim(0,80)
plt.ylim(0,12)
plt.title(' Exercício 4 - numérico')
plt.xlabel('x (m)', size = 20)
plt.ylabel('y (m)', size = 20)
plt.grid()
plt.show()
```


    <IPython.core.display.Javascript object>







```python
from IPython.display import Image
Image("C:\\2tri2018\\Ex4a.png")
```


```python
from IPython.display import Image
Image("C:\\2tri2018\\Ex4b.png")
```


```python
x = x0
y = y0
vx = vx0
vy = vy0
r = np.array([x,y])
while y >= 0:
    dxdt = vx
    x = x + dt * dxdt
    dydt = vy
    y = y + dt * dydt
    dvxdt = -b/m*np.sqrt(vx**2+vy**2)*vx
    vx = vx + dt * dvxdt
    dvydt = -b/m*np.sqrt(vx**2+vy**2)*vy - g
    vy = vy + dt * dvydt
    r = np.vstack((r, np.array([x,y])))

plt.figure()
plt.plot(r[:,0],r[:,1])
plt.xlim(0,80)
plt.ylim(0,12)
plt.title(' Exercício Modelo')
plt.xlabel('x (m)', size = 20)
plt.ylabel('y (m)', size = 20)
plt.grid()
plt.show()
```


    <IPython.core.display.Javascript object>







```python
from IPython.display import Image
Image("C:\\2tri2018\\Ex4b.png")
```


```python
display(Math(latex('SOLOÇÃO__NUMÉRICA') ))
display(Math(r'$\frac{dv_x}{dt} = -\frac{b}{m} \frac{1}{\sqrt{vx^2 + vy^2}} v_x'))
display(Math(r'$\frac{dx}{dt} =  v_x'))
display(Math(r'$\frac{dv_y}{dt} = -\frac{b}{m} \frac{1}{\sqrt{vx^2 + vy^2}} v_y - g'))
display(Math(r'$\frac{dv}{dt} =  v_y'))
```


$$SOLOÇÃO__NUMÉRICA$$



$$\frac{dv_x}{dt} = -\frac{b}{m} \frac{1}{\sqrt{vx^2 + vy^2}} v_x$$



$$\frac{dx}{dt} =  v_x$$



$$\frac{dv_y}{dt} = -\frac{b}{m} \frac{1}{\sqrt{vx^2 + vy^2}} v_y - g$$



$$\frac{dv}{dt} =  v_y$$



```python
x = x0
y = y0
vx = vx0
vy = vy0
r = np.array([x,y])
while y >= 0:
    dxdt = vx
    x = x + dt * dxdt
    dydt = vy
    y = y + dt * dydt
    dvxdt = -(b/m)*(1/np.sqrt(vx**2+vy**2))*vx
    vx = vx + dt * dvxdt
    dvydt = -(b/m)*(1/np.sqrt(vx**2+vy**2))*vy - g
    vy = vy + dt * dvydt
    r = np.vstack((r, np.array([x,y])))

plt.figure()
plt.plot(r[:,0],r[:,1])
plt.xlim(0,80)
plt.ylim(0,12)
plt.title(' Exercício Modelo')
plt.xlabel('x (m)', size = 20)
plt.ylabel('y (m)', size = 20)
plt.grid()
plt.show()
```


    <IPython.core.display.Javascript object>







```python

```

942bec66e8ca9e973cb44c0136bbcfbf7c27210e
ipynb
Jupyter Notebook
courses/modsim2018/Task1C_Edson.ipynb
rodgraneiro/bmc
b974a22a939426ab216e36b9386f3ff294387625
MIT
courses/modsim2018/Task1C_Edson.ipynb
rodgraneiro/bmc
b974a22a939426ab216e36b9386f3ff294387625
MIT
courses/modsim2018/Task1C_Edson.ipynb
rodgraneiro/bmc
b974a22a939426ab216e36b9386f3ff294387625
MIT
Qwen/Qwen-72B
1. YES
2. YES