# Function 

### Projectile

\begin{equation}
R=\frac{u^2\sin 2\theta}{g}
\end{equation}

\begin{equation}
TF=\frac{2u\sin \theta}{g}
\end{equation}

\begin{equation}
H=\frac{u^2\sin^2\theta}{2g}
\end{equation}


```python
import numpy as np                     # from numpy import* not required to write np
import pandas as pd                    # from pandas import* 
import matplotlib.pyplot as pltfrom    # from matplotlib import*
%matplotlib inline
```


```python
def projectile(u,theta):    
    g=9.8                                        # acceleration due to gravity
    R = u**2*np.sin(2*np.pi*theta/180)/g         # range
    H= u**2*np.sin(np.pi*theta/180)**2/(2*g)     # max. height
    TF = 2*u*np.sin(np.pi*theta/180)/g           # time of flight      
    return [R,H,TF]  
```


```python
p=projectile(100,60)
p
```




    [883.699391616774, 382.6530612244897, 17.67398783233548]




```python
Angle=[]  #list for angle
R=[]      #list for range
H=[]      # list for height
TF=[]      #list for time of flight
for angle in range(1,91):
    a=projectile(100,angle)
    Angle.append(angle)
    R.append(a[0])  # added element  in list R
    H.append(a[1])  # added element  in list H
    TF.append(a[2]) # added element  in list TF    
```


```python
plt.plot(Angle,R,'g-.',label='Range')
plt.plot(Angle,H,'b^',label='Max.height')
plt.xlabel('Angle(degree)')
plt.ylabel('Distance(m)')
plt.title('Projectile')
plt.legend()
plt.show()
```


```python
plt.plot(Angle,TF,'k*')
plt.xlabel('Angle(degree)')
plt.ylabel('Time of flight(sec)')
plt.title('Projectile')
plt.savefig('projective.eps')
plt.show()
```


```python
data={}    # dictionary
data.update({"Angle":Angle,"Range":R ,"Time of flight":TF,"Max.Height": H})
```


```python
DF = pd.DataFrame(data)
DF
```


```python
DF.to_csv("projectile.csv")  #save data in csv format in excel
```


```python

```

8da22f580e66d5dc077914384d92d0bcdf6f34c6
ipynb
Jupyter Notebook
func_pms1.ipynb
AmbaPant/NPS
0500f39f6708388d5c3f2b8d3e5ee5e56a1f646f
MIT
2020-09-16T03:21:55.000Z
2020-09-16T03:21:55.000Z
func_pms1.ipynb
AmbaPant/NPS
0500f39f6708388d5c3f2b8d3e5ee5e56a1f646f
MIT
func_pms1.ipynb
AmbaPant/NPS
0500f39f6708388d5c3f2b8d3e5ee5e56a1f646f
MIT
2020-08-10T12:17:21.000Z
2020-09-13T14:31:02.000Z
Qwen/Qwen-72B
1. YES
2. YES