forked from MuhammadIsahmtrr/Tutorial_01
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdist.py
More file actions
14 lines (11 loc) · 649 Bytes
/
Copy pathdist.py
File metadata and controls
14 lines (11 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
#Author: Lennaert van Veen
#Date: 1/17/2023
# Python function that computes the distance travelled by a cannon ball with air friction.
# In: theta, angle of the shot; c, coefficient of air friction;
# g, accelleration of gravity; V0, initial speed. See lecture 3.
# A solution of dist=R is the angle at which to tilt the canon for given c, g and V0.
import numpy as np
def dist(theta,c,g,V0):
return (1/c) * np.log((c*V0*np.cos(theta)/np.sqrt(c*g)) * \
(np.arctan(np.sqrt(c/g)*V0*np.sin(theta)) + \
np.arccosh(np.sqrt((g+c* V0**2 * np.sin(theta)**2)/g)))+1.0)