#### • Class 11 Physics Demo

Explore Related Concepts

#### • find percentage increase between two numbers

From Wikipedia

Interpolation

In the mathematical subfield of numerical analysis, interpolation is a method of constructing new data points within the range of a discrete set of known data points.

In engineering and science one often has a number of data points, as obtained by sampling or experimentation, and tries to construct a function which closely fits those data points. This is called curve fitting or regression analysis. Interpolation is a specific case of curve fitting, in which the function must go exactly through the data points.

A different problem which is closely related to interpolation is the approximation of a complicated function by a simple function. Suppose we know the function but it is too complex to evaluate efficiently. Then we could pick a few known data points from the complicated function, creating a lookup table, and try to interpolate those data points to construct a simpler function. Of course, when using the simple function to calculate new data points we usually do not receive the same result as when using the original function, but depending on the problem domain and the interpolation method used the gain in simplicity might offset the error.

It should be mentioned that there is another very different kind of interpolation in mathematics, namely the "interpolation of operators". The classical results about interpolation of operators are the Rieszâ€“Thorin theorem and the Marcinkiewicz theorem. There are also many other subsequent results.

## Example

For example, suppose we have a table like this, which gives some values of an unknown function f.

Interpolation provides a means of estimating the function at intermediate points, such as x&nbsp;=&nbsp;2.5.

There are many different interpolation methods, some of which are described below. Some of the concerns to take into account when choosing an appropriate algorithm are: How accurate is the method? How expensive is it? How smooth is the interpolant? How many data points are needed?

### Piecewise constant interpolation

The simplest interpolation method is to locate the nearest data value, and assign the same value. In one dimension, there are seldom good reasons to choose this one over linear interpolation, which is almost as cheap, but in higher dimensional multivariate interpolation, this can be a favourable choice for its speed and simplicity.

### Linear interpolation

One of the simplest methods is linear interpolation (sometimes known as lerp). Consider the above example of determining f(2.5). Since 2.5 is midway between 2 and 3, it is reasonable to take f(2.5) midway between f(2) = 0.9093 and f(3) = 0.1411, which yields 0.5252.

Generally, linear interpolation takes two data points, say (xa,ya) and (xb,yb), and the interpolant is given by:

y = y_a + (y_b-y_a)\frac{(x-x_a)}{(x_b-x_a)} at the point (x,y)

Linear interpolation is quick and easy, but it is not very precise. Another disadvantage is that the interpolant is not differentiable at the point xk.

The following error estimate shows that linear interpolation is not very precise. Denote the function which we want to interpolate by g, and suppose that x lies between xa and xb and that g is twice continuously differentiable. Then the linear interpolation error is

In words, the error is proportional to the square of the distance between the data points. The error of some other methods, including polynomial interpolation and spline interpolation (described below), is proportional to higher powers of the distance between the data points. These methods also produce smoother interpolants.

### Polynomial interpolation

Polynomial interpolation is a generalization of linear interpolation. Note that the linear interpolant is a linear function. We now replace this interpolant by a polynomial of higher degree.

Consider again the problem given above. The following sixth degree polynomial goes through all the seven points:

f(x) = -0.0001521 x^6 - 0.003130 x^5 + 0.07321 x^4 - 0.3577 x^3 + 0.2255 x^2 + 0.9038 x.

Substituting x = 2.5, we find that f(2.5) = 0.5965.

Generally, if we have n data points, there is exactly one polynomial of degree at most n&minus;1 going through all the data points. The interpolation error is proportional to the distance between the data points to the power n. Furthermore, the interpolant is a polynomial and thus infinitely differentiable. So, we see that polynomial interpolation solves all the problems of linear interpolation.

However, polynomial interpolation also has some disadvantages. Calculating the interpolating polynomial is computationally expensive (see computational complexity) compared to linear interpolation. Furthermore, polynomial interpolation may exhibit oscillatory artifacts, especially at the end points (see Runge's phenomenon). These disadvantages can be avoided by using spline interpolation or restricting attention to Chebyshev polynomials.

### Spline interpolation

Remember that linear interpolation uses a linear function for each of intervals [xk,xk+1]. Spline interpolation uses low-degree polynomials in each of the intervals, and chooses the polynomial pieces such that they fit smoothly together. The resulting function is called a spline.

For instance, the natural cubic spline is piecewise cubic and twice continuously differentiable. Furthermore, its second derivative is zero at the end points. The na

Question:Use the table below and interpolate the expected value of number of sit-ups performed by someone who is 19 years old... The average number of sit-ups performed by students of different ages AGE / number of sit ups in a physical fitness test 16\80 18\86 20\92 22\96 24\100 26\110

Answers:Well 19 is between 18 and 20, so average those two values together to find your answer! 86 for a person 18 and 92 for a 20 year old = 86+92=178. 178/2 is 89. The answer is 89 situps for a 19 year old

Question:I have two 2d boxes drawn on planes in 3d space, the planes have arbitrary normals and positions. I want to interpolate between the two planes to draw the walls of a tunnel that connects them as a smooth surface. Here's a picture of what I mean- http://i26.tinypic.com/bev48w.jpg I have the red bits (info: position, rotation, width, height, forward vector, up vector, position of points etc) and want to calculate points along the green line and from it the grey lines. What kind of interpolation function would best suit this, or even better what steps do I need to take to compute it? Thanks Puzzling, but linear interpolation is what I want to avoid. Consider two rectangles side by side in the same plane, A and B- A.forward = +Z A.upward = +Y B.forward = -Z B.upward = -Y I need a spline-like curve that takes into account the rotation here's what I have using splines- http://i31.tinypic.com/29619hc.jpg I think I worked it out, I should be finding the natural cubic b-spline from (A-A.direction) -> A -> B -> (B+B.direction) finished result: http://i28.tinypic.com/sybck5.jpg

Answers:Assuming a linear interpolation of each, I would just do each component separately. Here I'll assume the time goes from 0 (everything at position 1) to 1 (everything at position 2) Start with the position (x1, y1, z1) and (x2, y2, z2) being the center of the rectangle. The position at time t = 0 is (x1, y1, z1) The position at time t = 1 is (x2, y2, z2) Position at time t (x(t), y(t), z(t)) is: x(t) = x1(1 - t) + x2 t y(t) = y1(1 - t) + y2 t z(t) = z1(1 - t) + z2 t That would get you the green line. I use a similar interpolation over time for the surface normal (forward vector I guess), the rotation vector (up vector)?, the height and width, etc. If I remembered more of my matrix and vector mulitplication I'd show you how to do it there, but I'm sure you can figure it out. P.S. I'd love to see the results when you are done...

Question:the values i obtained from the r134a steam table are: @40psia and 60F h=112.6 at 80F h=117.0 and @50 psia and 40F h=111.9 at 80F h=116.3 h is the enthalpy and i need to find it for 42psia and 66F. i need to interpolate to get the value of h. i would like to see the steps used to interpolate. thanks for your help Jason

Answers:1. Interpolate between 60F and 80F to get h at 66F at 40 psi (66-60) / (80-60) * (117.0-112.6) + 112.6 = h@66.40 2. Interpolate between 40F and 80F to get h at 66F at 50 psi (66-40) / (80-40) * (116.3 - 111.9) + 111.9 = h@66.50 3. Interpolate the above two values to get value at 42 psi (42-40) / (50-40) * (h@66.40 - h@66.50) + h@66.40 = h@66.42

Question:In ASP (classic asp) how can I generate 5 unique random numbers (being each of them is greater than the previous one), between two numbers? For example, I want to generate 5 numbers between 1 and 1000. It must generate like these: 45-66-124-534-794

Answers:Although Jareh's solution will work, you'll notice that it will have a tendency to result in numbers that are close to the upper-bound. To demonstrate, I just tried it a few times and got: 1) 257 586 866 945 946 2) 680 929 960 981 997 3) 633 922 992 993 996 4) 494 788 826 896 907 5) 843 964 994 996 997 6) 168 260 732 888 893 7) 84 653 928 975 992 The first value is nicely random, but as it goes on, you get progressively very high numbers. In fact, the last value will be more than 900 about 91 percent of the time, when instead, the top number should be over 900 about 41 percent of the time. In general with this method, you'll get numbers that are approximately in the ballpark of: 500 750 875 938 969 What you want to do instead is put the random numbers into an array and then sort the array. I'm not an ASP guy so this may be full of bugs. If so, you should be able to fix them easily, but you want something like this: Randomize Dim Values(5),t,i,Tmp,Min,Count,Max Min = 0 '*** Minimum value Max = 1000 '*** Maximum value Count = 5 '*** Number of values for t= 1 to Count Values(t) = INT(((Max - Min) * Rnd) + Min) next '*** Ideally, you'd sort the Values array here. '*** Unfortunately, it looks like there isn't a '*** sort function in ASP? Hence, let's do it '*** ourselves. But really, you'd write a QuickSort '*** algorithm and use that. for t= 1 to Count-1 for i= t+1 to Count if(Values(t) < Values(i) then Tmp = Values(t) Values(t) = Values(i) Values(i) = Tmp end if next next '*** Ok, now it's sorted, so we can print them out. for t= 1 to Count response.write (Values(t) & "
") next DaveE