Project

Python program to calculate drag force against a cyclist

The following is the program for calculating drag forces against a cyclist, although it depends on various factors like frontal area, velocity, shape of that object which decides its drag coefficient.
In the program I took some of the default values for the same and put it into the formula to gain the results.
The program goes like this
#Program for calculating drag force against a cyclist
#by Tarun Gupta

import matplotlib.pyplot as plt
#Inputs
#Frontal_Area(m2)
A=1.75
#Density(kg/m3)
d=1.12

#function to plot drag forces vs velocity
#Velocity(m2)
v=[2,3,4,5,6,7,8,9]
#Drag_Coefficient
cd=0.75

drag_forces=[]

for velocity in v:
    drag_forces.append((0.5*A*d*cd*velocity*velocity))
    
plt.plot(drag_forces,v)
plt.ylabel('velocity')
plt.xlabel('drag force')
plt.title('Drag force vs Velocity')
plt.show()

#function to plot drag force vs drag coefficient
#Velocity(m2)
V=4
#Drag_coefficient 
c_d=[0.25,0.75,1.25,1.5,2.25,3,3.25,4]

dragforces=[]

for drag in c_d:
    dragforces.append((0.5*A*d*drag*V*V))
    
plt.plot(drag_forces,c_d)
plt.ylabel('Drag coefficient')
plt.xlabel('Drag force')
plt.title('Drag force vs Drag coefficient')
plt.show()


The above are the results shown in the form of the graph displaying different values of the velocity and drag coefficient to calculate the drag forces acting upon the cyclist.

Thankyou.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.