Part II: Linear Motion (4 points) If an object moves in a straight line at a giv
ID: 3747698 • Letter: P
Question
Part II: Linear Motion (4 points) If an object moves in a straight line at a given initial velocity vi and constant acceleration a for t units of time, its final displacement s (the total distance moved) can be calculated using the formula where t, and tf represent the starting and ending times of the movement, respectively (i.e, if t, was 3 and tf was 7, then the object was in motion for a total of 7 3 or 4 time units) Complete the displacement function, which takes four numerical arguments, in order: 1. the object's initial velocity vi 2. the object's acceleration a, which can be either positive (acceleration) or negative (deceleration) 3. the time () at which the object began to move 4. the time (tf) at which the object stopped moving This function calculates and returns a numerical value corresponding to the object's total displacement s, using the formula given above. You may assume that ty is always strictly greater than t Examples: Return Value 66.0 Function Call displacement (5, 2, 1, 7) displacement (3, 1, 4, 20) 176.0 displacement (18, -3, 2, 6) 48.0Explanation / Answer
def displacement(v, a, ti, tf): return v*(tf - ti) + 0.5*a*(tf - ti)**2 print(displacement(5, 2, 1, 7)) print(displacement(3, 1, 4, 20)) print(displacement(18, -3, 2, 6))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.