# CSCI 2500 Assignment 1 Linear Interpolation

\$30.00

## Description

Frequently when doing experiments we have “holes” in our data. For example, when measuring population
growth in cities or temperature change during an experiment we typically do not have continuous data but
rather samples taken at discrete points in time. Linear interpolation is one way to find these points.
Your task is to fill in the functions to complete the program skeleton given in the template file. This is a
relatively short program to ensure everyone is up to speed on C programming topics. Your program should
accept non-negative X values and arbitrary Y values. It should exit immediately upon non-increasing X
values.
Below are some sample output. Note that your program should match these samples exactly.
bash-3.2\$ ./a.out
How many data points would you like to enter? (2 or more): 3
Point[0] is ( 1.000, 1.000)
Point[1] is ( 2.000, 2.000)
Point[2] is ( 3.000, 3.000)
Please enter an X coordinate (-1 to exit): 1.5
1.500 maps to ( 1.500, 1.500)
Please enter an X coordinate (-1 to exit): 2.5
2.500 maps to ( 2.500, 2.500)
Please enter an X coordinate (-1 to exit): 3.5
3.500 cannot be interpolated
Please enter an X coordinate (-1 to exit): -1
bash-3.2\$
bash-3.2\$ ./a.out
How many data points would you like to enter? (2 or more): 6
1
Point[0] is ( 0.500, 1.000)
Point[1] is ( 0.800, 14.000)
Point[2] is ( 1.300, -2.750)
Point[3] is ( 2.500, -8.350)
Point[4] is ( 3.500, 0.000)
Point[5] is ( 4.300, 4.000)
Please enter an X coordinate (-1 to exit): 1.4
1.400 maps to ( 1.400, -3.217)
Please enter an X coordinate (-1 to exit): 2.6
2.600 maps to ( 2.600, -7.515)
Please enter an X coordinate (-1 to exit): 2.5
2.500 maps to ( 2.500, -8.350)
Please enter an X coordinate (-1 to exit): 3.4
3.400 maps to ( 3.400, -0.835)
Please enter an X coordinate (-1 to exit): 4.0
4.000 maps to ( 4.000, 2.500)
Please enter an X coordinate (-1 to exit): -1
bash-3.2\$
bash-3.2\$ ./a.out
How many data points would you like to enter? (2 or more): 3