Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm using python 3.7 and Spyder. Program 2: [This will help you understand cut & paste code reuse] [30 POINTS] In the earlier team project,

I'm using python 3.7 and Spyder.

Program 2: [This will help you understand cut & paste code reuse] [30 POINTS]

In the earlier team project, your team put together a program that interpolated between two values. This was a one dimensional (1D) interpolation, since you were interpolating only a single value, the distance on the track. You are now going to extend that program to one that will linearly interpolate between two points in 3D.

  1. Write a program that will take two observed 3D positions at two points in time, and then will calculate the 3D position at a third point in time. You should output the x, y, and z values for that position on separate lines. Begin by identifying the variables you will use, the names for those variables, and the computations that should occur for those variables. Then, write a program that will output the 3D position of the interpolated point on 3 separate lines. Save this program as Program2a.

For this initial program, you can use the following data values:

At time 13, observed position was (1, 3, 7)

At time 84, observed position was (23, -5, 10)

You want to find the position at time 50

  1. Now, copy Program2a into a new program, Program2b. You are going to modify the program in the following ways:
    1. When outputting the position, follow the output by a line of dashes (------------------).
    2. Instead of just computing the interpolation at one point and printing the result, you will now compute it at 5 points. Copy the portion of the code (cut and paste the code) that is needed to recompute interpolation 5 times. You should now interpolate at the times in increments of 1 unit, starting at time 50 (i.e. at times 50, 51, 52, 53, 54), outputting the result each time. The line of dashes will separate each computation.
      1. Note: later we will see how we can do this more efficiently, without cutting-and-pasting code, but for now, cut-and-paste is fine.

  1. Finally, copy Program2b into a new program, Program2c. Modify the program in the following way:
    1. Create variables for the starting time of interpolation, and the ending time of interpolation.
    2. You should display the results from interpolating at 5 points, evenly spaced from the beginning time to the ending time, inclusive.
    3. Experiment on your own with assigning different values to those variables verify that you are in fact interpolating correctly from one point to another.

For the version you save and turn in, show an interpolation from time 20 to 50.

spyder ide

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

More Books

Students also viewed these Databases questions

Question

Be able to suggest some future options for human resources

Answered: 1 week ago

Question

Be able to create a contract for consultant services

Answered: 1 week ago