Question: [VPYTHON] I have a project for physics that involves coding. It involves projectile motion with air drag. I can't seem to get the air drag

[VPYTHON] I have a project for physics that involves coding. It involves projectile motion with air drag. I can't seem to get the air drag part right. Any tips? My code is copied below:

GlowScript 2.7 VPython scene.width=600 scene.height=600 scene.center=vec(120,5,0) scene.range=150

velocity_person = 15 degrees = 45 angle=radians(degrees) mass_hammer = 7.26 velocity_hammer = 45 Lx = velocity_hammer*cos(angle) Ly = velocity_hammer*sin(angle)

''' Air drag variables''' rho = 1.2 c = .47 A = pi*1**2 F_drag= .5*c*rho*A*velocity_hammer**2

floor = box(pos=vec(0,-1,0), size=vec(500,0.1,50), color=color.yellow) body = box(pos=vec(-20,3.5,0), size=vec(1,7,1), color=color.blue) head = sphere(pos=vector(-20,7,0), radius=1.5) hammer = sphere(pos=vector(-15,3.5,0), radius=1, color=color.red, make_trail=True) head.velocity = vector(velocity_person,0,0) body.velocity = vector(velocity_person,0,0) dt = 0.01 while head.pos.x< -10: rate(50) head.pos=head.pos+head.velocity*dt body.pos=body.pos+head.velocity*dt hammer.rotate(angle=.01, axis = vector(-15,3.5,0)) hammer.velocity=vector(Lx,Ly,0) hammer.acceleration=vector(0,-9.8,0)

'''Here's where I need help. I need to include air drag in the 'while' loop''' while hammer.pos.y>= 0: rate(300) hammer.acceleration = hammer.acceleration - '''air drag: what do I put here?''' hammer.pos= hammer.pos + hammer.velocity*dt + .5*hammer.acceleration*dt**2 hammer.velocity= hammer.velocity + hammer.acceleration*dt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!