Modify the code so that the following are displayed in the animation display window: 1. Projectile mass. 2. Launch angle

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Modify the code so that the following are displayed in the animation display window: 1. Projectile mass. 2. Launch angle

Post by answerhappygod »

Modify The Code So That The Following Are Displayed In The Animation Display Window 1 Projectile Mass 2 Launch Angle 1
Modify The Code So That The Following Are Displayed In The Animation Display Window 1 Projectile Mass 2 Launch Angle 1 (25.2 KiB) Viewed 32 times
Web VPython 3.2from vpython import *
canvas(width = 1300, height = 1000)
projectile = sphere(pos = vector(0,0,0), radius = 0.35, color = color.red, make_trail = True)
projectile.speed = 10 # Initial speed.projectile.angle = 45*3.141459/180 # Initial angle, from the+x-axis.
projectile.velocity =vector(projectile.speed*cos(projectile.angle), projectile.speed*sin(projectile.angle), 0)
projectile.mass = 1.0grav_field = 1.0
dt = 0.01time = 0b = 0.5
speed = "Speed: "+str(projectile.speed)# the first text objecttext(text = speed, pos = vector(-25, 10, 5), color = vector(0.5, 1, 1))angle = "Angle: " + str(projectile.angle)# the second text objecttext(text = angle, pos = vector(-25, 15, 5), color = vector(0, 1, 0))
position = "Position: " + str(projectile.pos)# the third text objecttext(text = position, pos = vector(-25, 20, 5), color = vector(0, 1, 0))
while (projectile.pos.y >=0): rate(250) # Calculate the force. grav_force =vector(0,-projectile.mass*grav_field,0)
force = grav_force # Drag Force f_drag = - (b) * (projectile.velocity) # Update velocity. projectile.velocity = projectile.velocity +force/projectile.mass * dt
# Update position. projectile.pos = projectile.pos +projectile.velocity * dt # Update time. time = time + dt
Modify the code so that the following are displayed in the animation display window: 1. Projectile mass. 2. Launch angle 3. Launch speed 4. Current speed. 5. Maximum height. 6. Horizontal distance traveled 7. Comment out or replace the drag force with the air resistance of the form 7a air resistance COAV²0 Here, C is the drag coefficient, pis air density, and A is the frontal area of the projectile. In this lab, we will choose C=0.1, p= 1.225 kg/m³ and the frontal area is the area of a circle with the same radius as the sphere.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply