subject

The purpose of this activity is to practice writing simple programs that require multiple variables, and to ensure you understand the idea of interpolation. the individual assignment will build on this program.

write a short program in python that performs linear interpolation. here is the scenario:

you arrive at a racetrack and observe a car moving around a track at what appears to be a constant speed. you would like to be able to predict where the car is at any point in time. to do this, you take a measurement of how far around the track the vehicle has traveled at two points in time. assume that the track is marked so that you can determine position very precisely. you note the time of this first position measurement. a short while later (before the vehicle has passed the "starting" point on the track), you take a second measurement for how far around the track the vehicle has traveled, again noting the time.

now, assume that you’d like to reconstruct the position of the vehicle at any time between the first measurement and the second. since you assume the vehicle is moving at constant speed, this calculation can be found precisely by linear interpolation.

as a team, determine what variables you will need to use, and what formula(s) you will need to use to perform this calculation. you should use variables for all of the values that could change.

now, assume that for your observation, the first measurement was taken 30 seconds after you arrived, and the second was taken 45 seconds after you arrived. at the first measurement, the car was 50 meters past the starting line of the track. at the second measurement, the car was 615 meters past the starting line of the track.

write a program that determines, for any time between 30 and 45 seconds, where the car will be on the track (in terms of meters past the starting line). the time to evaluate at should be a variable in your program. the program should print both the time and the position at that time to the screen, with a line describing what is being output. you should test your program at various times and make sure the results seem reasonable.

for your final program that you turn in, you can assume that you want to know the position at a time 37 seconds after you first arrived. (next week, we will see how you can read in numbers from a user, but for now, just assume it is a fixed number of seconds.)

assume the racetrack is circular with radius 0.5 kilometers. notice that every time the car passes the starting point of the track, its "distance" from the starting point gets reset to 0. so, if you go far into the future, say at a point 20 minutes after your arrival time, simple linear interpolation will not work. see if you can modify your code to report distances correctly regardless of the time.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
question
Computers and Technology, 24.06.2019 10:00
(, urgent need): how do i change my username
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
In the microsoft® access® and microsoft excel® programs, the ribbon contains tabs that are divided into with like tools in them. parts groups containers bunches
Answers: 1
You know the right answer?
The purpose of this activity is to practice writing simple programs that require multiple variables,...
Questions
question
Mathematics, 12.02.2020 23:53
Questions on the website: 13722363