Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a ball resting on the ground that is then kicked. This gives it a velocity of v at an angle of degrees from the

Consider a ball resting on the ground that is then kicked. This gives it a velocity of v at an angle of degrees from the horizontal x-axis. We can represent this ball using an object ball = Ball() and store its (x,y) position in ball.position. We want to use its method ball.step(delta_t) to update the position of the ball after a period of time delta_t has passed. Complete the code to achieve this. You may assume that acceleration due to gravity is 9.81ms-2, the ball is a point mass, there is no air resistance, and that the ball will collide inelastically with the ground! image text in transcribed

For example: image text in transcribed

import numpy as np class Ball(): def __init__(self, theta, v): self.position = np.array([0, 0]) # Position at ground is (0,0) # Fill this in. def step(self, delta_t = .1): # Fill this in. Update position before anything else!

V ay o >X ball-Ball () bell. position = (x,y] - Test Result ball Ball(theta = 30, v = 100) Ball is at x=866.63m, y=11.95m for t in range (200): ball.step(delta_t = 0.05) print(f'Ball is at x={ball.position[@]:.2f}m, y={ball.position[1]:.2f}m') # Check position ball Ball(theta 10, v = v = 5) Ball is at x=0.49m, y=0.04m for t in range (10): ball.step(delta_t = 0.01) = print(f'Ball is at x={ball.position[@]:.2f}m, y={ball.position[1]: 2f}m') # Check position ball = Ball(theta = 80, v = 600) Ball is at x=1041.89m, y=5423.25m for t in range (100): ball.step(delta_t = 0.1) print(f'Ball is at x={ball.position[@]:.2f}m, y={ball.position[1]:.2f}m') # Check position V ay o >X ball-Ball () bell. position = (x,y] - Test Result ball Ball(theta = 30, v = 100) Ball is at x=866.63m, y=11.95m for t in range (200): ball.step(delta_t = 0.05) print(f'Ball is at x={ball.position[@]:.2f}m, y={ball.position[1]:.2f}m') # Check position ball Ball(theta 10, v = v = 5) Ball is at x=0.49m, y=0.04m for t in range (10): ball.step(delta_t = 0.01) = print(f'Ball is at x={ball.position[@]:.2f}m, y={ball.position[1]: 2f}m') # Check position ball = Ball(theta = 80, v = 600) Ball is at x=1041.89m, y=5423.25m for t in range (100): ball.step(delta_t = 0.1) print(f'Ball is at x={ball.position[@]:.2f}m, y={ball.position[1]:.2f}m') # Check position

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Tools for Business Decision Making

Authors: Paul D. Kimmel, Jerry J. Weygandt, Donald E. Kieso

6th edition

1118096894, 978-1-11921511, 978-1118096895

Students also viewed these Accounting questions

Question

=+b) What are the standard deviations for each action?

Answered: 1 week ago