The purpose of this assignment is to practice Problem Solving and Computational Thinking to develop a Python solution to

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

The purpose of this assignment is to practice Problem Solving and Computational Thinking to develop a Python solution to

Post by answerhappygod »

The Purpose Of This Assignment Is To Practice Problem Solving And Computational Thinking To Develop A Python Solution To 1
The Purpose Of This Assignment Is To Practice Problem Solving And Computational Thinking To Develop A Python Solution To 1 (45.8 KiB) Viewed 29 times
The Purpose Of This Assignment Is To Practice Problem Solving And Computational Thinking To Develop A Python Solution To 2
The Purpose Of This Assignment Is To Practice Problem Solving And Computational Thinking To Develop A Python Solution To 2 (48.99 KiB) Viewed 29 times
The Purpose Of This Assignment Is To Practice Problem Solving And Computational Thinking To Develop A Python Solution To 3
The Purpose Of This Assignment Is To Practice Problem Solving And Computational Thinking To Develop A Python Solution To 3 (39.66 KiB) Viewed 29 times
The purpose of this assignment is to practice Problem Solving and Computational Thinking to develop a Python solution to the trajectory problem [1]. In particular the leverage the use of repetitions and selection control structures and the Turtle library. Apex D range Figure 1: Projectile trajectory Problem definition We want to plot the trajectory of a projectile with inclusion of air resistance (Fig. 2). We will also calculate the apex, and range defined as the highest point, and the landing points of the projectile respectively (Fig. 3). The air resistance drag force F4, in Newton is approximated by the following relation: Fe = Cou? Where, v is the magnitude of velocity in " and Ca is the coefficient of drag. The following is a step-by-step guide to writing up the script. The initial velocity can be expressed as x-component and y-component: (vx = v cose Ivy = v sine (2) Where, v stands for initial velocity magnitude and refers to projectile angle, or the angle that the velocity forms with the positive x-axis (Fig. 1). To get the acceleration, we need to find the resultant force, which consists of the air drag Fa and the weight W: Fe = C v2 W = Mg (3) The x and y components of the resultant force are given by: SF, = -Fe cose IFY = -Mg- Fasine (4) 1
The force components follow the convention that they are positive when pointing to the right and upwards. Newton's second law thus gives the acceleration of the projectile given by: (5) 17) Update the velocity for every time-step. To get the velocity at the next time step, we make use of the following approximation: (...) = v(.) + act.) At. (6) Then update the positions: f(t) = (t.) + v... ) by(+1) = y(c.) + xy(t. A Note: The velocity magnitude is calculated after each time step, and then the drag force and acceleration are updated accordingly. To find the velocity magnitude at each time step, use the following equation: V = 0;} + vy? Tasks Design and implement a Python program that uses the turtle library to simulate and plot the trajectory of the projectile as shown in the sample runs (Fig. 2). Your program should • Ask the user to enter the angle that the velocity forms with the positive x -axis. The angle must be in the range 20, 60 degrees. • Keep asking the user to reenter if the input is not in the specified range of valid values Fiz 3). Starting with x = 0 and y = 0 at t = 0, we can use the equations (6) and (7) to get the positions for the next time-steps using the velocities found previously • Display on the console the current projectile position, the apex position coordinates, and the range (Fig. 3) Additional requirements: • The simulation area in cyan where the width is 300 pixels and the length is twice its width. • The contour is black, 5 pixels thick (Fig. 2). • Use loops to draw the contour. • The initial position of the projectile should be in the bottom-left corner, which corresponds to the origin • Initialize the parameters as following: M = 2.0 (mass of projectile in kgl. g = 9,8 (acceleration due to gravity in m/s^2), V = 150 (initial velocity in m/s), Cd = 0.005 (drag coefficient), and dt = 0.09 (time step in s} Deliverables Engage first in problem solving and thinking to set up the approach that you will later implement in the computer program. a) Start by defining the purpose of the program, then identify the input and output variables. 2
b) Write down the solution or algorithm in pseudo-code. c) Translate your solution into a Python program d) Last, verify that your program is correct. For that, prepare a test plan. Select at least 3 values for the angle, which correspond to 3 different trajectories. e) Submit a Python source file: pa3_YourID.py. Your file will consist of two parts: (1) header documentation where you define the purpose, input/output data, the algorithm in pseudocode, & test plan, then the Python code Sample runs (a) A projectile with angle 8 = 60 degrees. (b) A projectile with angle 8 = 45 degrees (c) A projectile with angle 8 = 20 degrees. Figure 2: Sample runs Turtle canvas output WELONG TO THE PROJECTELE SECTORY STILATOR Enter the angle (20-65) in der 70 Tvaid it forces Enter the angle (20-0) in degrees 10 Trvallott torces Enter the angle (20-0) in degrees Xy 00 6.522267500000001 11.2173801264906) 12. 63391631660322 21.550553656507507 18.950759253014353 32.3473976950218 411.2390740920954 26.98045110429184 412.68123878905774 17.157625217997656 +3.441774584699) 8.75910332118147 Initial velocity: 150 / Angle: 0.00 Acceleration due to gravity >.8002 Dracottscent: 0.005 Tine step in 0.090 to! The per positionistes are xapex - 256.566. Yap 234.115 The D Figure 3. Sample runs console input/output 3
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply