PHYSICS 140 Study Guide - Final Guide: Dot Product

44 views2 pages
Published on 29 Apr 2019
School
U of M
Department
Physics
Course
PHYSICS 140
Professor
Solutions to sample modeling problems
1. Consider the following snippet of VPython code (with line numbers inserted) that purports to carry
out part of a 3-second simulation of a 3-kg object launched from the origin at an angle of 60 degrees
from the horizontal at time t = 0 in the presence of a drag force of the form
F
drag
= −αv
:
1) m = 3.0
2) g = vector(0, -9.8, 0)
3) alpha = 2
4) v0 = 15.
5) thetadeg = 60.
6) theta = thetadeg/180.*pi
7) vel = vector(v0*cos(theta), v0*sin(theta), 0.)
8) p = m*vel
9) ballpos = vector(0., 0., 0.)
10) t = 0.
11) dt = 0.01
12) while ballpos.y >= 0:
13) ballpos = ballpos + vel*dt
14) Fgrav = m*g
15) Fdrag = −alpha*vel
16) p = p + (Fgrav + Fdrag)*dt
17) vel = vel + p/m
18) t = t + dt
Which line contains a serious bug?
a) Line 13)
b) Line 14)
c) Line 15)
d) Line 16)
e) Line 17)
The instantaneous velocity is simply the instantaneous momentum divided by mass. One should not
increment by p/m each time.
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Grade+

Unlimited access to all notes and study guides.

YearlyMost Popular
75% OFF
$9.98/m
Monthly
$39.98/m
Single doc
$39.98

or

You will be charged $119.76 upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.