A Study Of Different Interpolation Methods Computer Science Essay

Discussed here are a figure of insertion methods, this is by no agencies an thorough list but the methods shown tend to be those in common usage in computing machine artworks. The chief properties is that they are easy to calculate and are stable. Interpolation as used here is different to `` smoothing '' , the techniques discussed here have the feature that the estimated curve base on ballss through all the given points. The thought is that the points are in some sense correct and lie on an implicit in but unknown curve, the job is to be able to gauge the values of the curve at any place between the known points.

Linear insertion is the simplest method of acquiring values at places in between the information points. The points are merely joined by consecutive line sections. Each section ( bounded by two informations points ) can be interpolated independently. The parametric quantity mu defines where to gauge the value on the interpolated line, it is 0 at the first point and 1 and the 2nd point.

Get quality help now
Sweet V
Sweet V
checked Verified writer
star star star star 4.9 (984)

“ Ok, let me say I’m extremely satisfy with the result while it was a last minute thing. I really enjoy the effort put in. ”

avatar avatar avatar
+84 relevant experts are online
Hire writer

For interpolated values between the two points mu scopes between 0 and 1. Valuess of mu outside this scope consequence in extrapolation. This convention is followed for all the subsequent methods at a lower place. As with subsequent more interesting methods, a snipping of field C codification will server to depict the mathematics.

dual LinearInterpolate (

dual y1, dual y2,

double mu )

{

return ( y1* ( 1-mu ) +y2*mu ) ;

}

Linear insertion consequences in discontinuities at each point. Often a drum sander extrapolating map is desirable, possibly the simplest is cosine insertion.

Get to Know The Price Estimate For Your Paper
Topic
Number of pages
Email Invalid email

By clicking “Check Writers’ Offers”, you agree to our terms of service and privacy policy. We’ll occasionally send you promo and account related email

"You must agree to out terms of services and privacy policy"
Write my paper

You won’t be charged yet!

A suited oriented piece of a cosine map serves to supply a smooth passage between next sections.

dual CosineInterpolate (

dual y1, dual y2,

double mu )

{

dual mu2 ;

mu2 = ( 1-cos ( mu*PI ) ) /2 ;

return ( y1* ( 1-mu2 ) +y2*mu2 ) ;

}

Cubic insertion is the simplest method that offers true continuity between the sections. As such it requires more than merely the two end points of the section but besides the two points on either side of them. So the map requires 4 points in all labeled y0, y1, y2, and y3, in the codification below. mu still behaves the same manner for extrapolating between the section y1 to y2. This does raise issues for how to extrapolate between the first and last sections. In the illustrations here I merely have n't bothered. A common solution is the dream up two excess points at the start and terminal of the sequence, the new points are created so that they have a incline equal to the incline of the start or terminal section.

dual CubicInterpolate (

dual y0, dual y1,

dual y2, dual y3,

double mu )

{

dual a0, a1, a2, a3, mu2 ;

mu2 = mu*mu ;

a0 = y3 - y2 - y0 + y1 ;

a1 = y0 - y1 - a0 ;

a2 = y2 - y0 ;

a3 = y1 ;

return ( a0*mu*mu2+a1*mu2+a2*mu+a3 ) ;

}

Hermite insertion like three-dimensional requires 4 points so that it can accomplish a higher grade of continuity. In add-on it has nice tenseness and biasing controls. Tension can be used to fasten up the curvature at the known points. The prejudice is used to writhe the curve about the known points. The illustrations shown here have the default tenseness and prejudice values of 0, it will be left as an exercising for the reader to research different tenseness and prejudice values.

/*

Tension: 1 is high, 0 normal, -1 is low

Biass: 0 is even,

positive is towards foremost section,

negative towards the other

*/

dual HermiteInterpolate (

dual y0, dual y1,

dual y2, dual y3,

dual mu,

dual tenseness,

double prejudice )

{

dual m0, M1, mu2, mu3 ;

dual a0, a1, a2, a3 ;

mu2 = mu * mu ;

mu3 = mu2 * mu ;

m0 = ( y1-y0 ) * ( 1+bias ) * ( 1-tension ) /2 ;

m0 += ( y2-y1 ) * ( 1-bias ) * ( 1-tension ) /2 ;

M1 = ( y2-y1 ) * ( 1+bias ) * ( 1-tension ) /2 ;

M1 += ( y3-y2 ) * ( 1-bias ) * ( 1-tension ) /2 ;

a0 = 2*mu3 - 3*mu2 + 1 ;

a1 = mu3 - 2*mu2 + mu ;

a2 = mu3 - mu2 ;

a3 = -2*mu3 + 3*mu2 ;

return ( a0*y1+a1*m0+a2*m1+a3*y2 ) ;

}

While you may believe the above instances were 2 dimensional, they are merely 1 dimensional insertion ( the horizontal axis is additive ) . In most instances the insertion can be extended into higher dimensions merely by using it to each of the x, Y, omega co-ordinates independently. This is shown on the right for 3 dimensions for all but the cosine insertion. By a cute fast one the cosine insertion reverts to linear if applied independently to each co-ordinate.

For other insertion methods see the Bezier, Spline, and piecewise Bezier methodsA here.

A

Linear

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linear.gif

Cosine

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/cosine.gif

Cubic

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/cubic.gif

Hermite

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/hermite.gif

3D additive

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linear3d.gif

3D three-dimensional

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/cubic3d.gif

3D Hermite

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/hermite3d.gif

Trilinear Interpolation

Written byA Paul Bourke

July 1997

Trilinear insertion is the name given to the procedure of linearly extrapolating points within a box ( 3D ) given values at the vertices of the box. Possibly its most common application is extrapolating within cells of a volumetric dataset.

See a unit regular hexahedron with the lower/left/base vertex at the beginning as shown here on the right.A

The values at each vertex will be denoted V000, V100, V010, ... .etc... .V111

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/trilinear.gif

The value at place ( x, y, omega ) within the regular hexahedron will be denoted VxyzA and is given by

VxyzA =

V000A ( 1 - ten ) ( 1 - Y ) ( 1 - omega ) +

V100A x ( 1 - Y ) ( 1 - omega ) +A

V010A ( 1 - ten ) Y ( 1 - omega ) +A

V001A ( 1 - ten ) ( 1 - Y ) omega +

V101A x ( 1 - Y ) omega +A

V011A ( 1 - ten ) y z +A

V110A x y ( 1 - omega ) +A

V111A x y omega

In general the box will non be of unit size nor will it be aligned at the beginning. Simple interlingual rendition and grading ( perchance of each axis independently ) can be used to transform into and so out of this simplified state of affairs.

Linear Arrested development

Written byA Paul Bourke

October 1998

Linear arrested development is a method to outdo tantrum a additive equation ( consecutive line ) of the signifier Y ( x ) =A aA +A bA ten to a aggregation of N points ( eleven, Lolo ) . WhereA bA is the incline andA aA the intercept on the Y axis.

The consequence will be stated below without derivation, that requires minimization of the amount of the squared distance from the information points and the proposed line. This map is minimised by ciphering the derivative with respect toA aA andA bA and puting these to nothing. For a more complete derivation see the `` Numeric Recipes in C '' .

The solution is clearer if we define the followers

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress2.gif

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress3.gif

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress4.gif

Then

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress5.gif

and

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress6.gif

And eventually the arrested development coefficient is

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress7.gif

This is 0 if there is no additive tendency, 1 for perfect additive tantrum.

Note

This treatment assumes there is no known discrepancy for the ten and Y values. There are solutions which can take this into history, this is peculiarly of import if some values are known with less mistake than others.

The solution above requires that the incline is non infinite, SxxA is non zero.

Example

The undermentioned illustration shows the points and the best fit line as determined utilizing the techniques discussed here.

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/linregress1.gif

Beginning

C

linregress.c

C++ contributed by Charles Brown

RegressionLine.cpp

RegressionLine.hpp

Curve Fit Through Arbitrary Points

Written byA Paul Bourke

August 1991

The undermentioned introduces a method of instantly deducing a multinomial that passes through an arbitrary figure of points. That is, happen a multinomial degree Fahrenheit ( ten ) that passes through the N points

( x0, y0 ) , ( x1, y1 ) , ( x2, y2 ) , ... .. ( xN-1, yN-1 )

The key to this solution is that we want an exact tantrum at the points givenA and we do n't care what happens inbetween those points. The general solution is

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/curvefit1.gif

To see how this works, see the merchandise term. When ten = xiA the merchandise term has the same denominator and numerator and therefore peers 1 and hence contributes yiA to the amount. All other footings in the summing up contribute 0 since there exists a ( xjA - xj ) in the numerator. Thankss to Simon Stegmaier for indicating out that this is known as a Lagrange Polynomial.

For a numerical illustration see the multinomial that passes through the undermentioned points

( 0,2 )

( 1,1 )

( 3,3 )

( 4,0 )

( 6,5 )

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/curvefit2.gif

The map utilizing the above expression is

degree Fahrenheit ( x ) = 2 * ( x-1 ) * ( x-3 ) * ( x-4 ) * ( x-6 ) / [ ( 0-1 ) * ( 0-3 ) * ( 0-4 ) * ( 0-6 ) ]

+ 1 * ( x-0 ) * ( x-3 ) * ( x-4 ) * ( x-6 ) / [ ( 1-0 ) * ( 1-3 ) * ( 1-4 ) * ( 1-6 ) ]

+ 3 * ( x-0 ) * ( x-1 ) * ( x-4 ) * ( x-6 ) / [ ( 3-0 ) * ( 3-1 ) * ( 3-4 ) * ( 3-6 ) ]

+ 0 * ( x-0 ) * ( x-1 ) * ( x-3 ) * ( x-6 ) / [ ( 4-0 ) * ( 4-1 ) * ( 4-3 ) * ( 4-6 ) ]

+ 5 * ( x-0 ) * ( x-1 ) * ( x-3 ) * ( x-4 ) / [ ( 6-0 ) * ( 6-1 ) * ( 6-3 ) * ( 6-4 ) ]

degree Fahrenheit ( x ) = ( x-1 ) * ( x-3 ) * ( x-4 ) * ( x-6 ) / 36

- ( x-0 ) * ( x-3 ) * ( x-4 ) * ( x-6 ) / 30

+ ( x-0 ) * ( x-1 ) * ( x-4 ) * ( x-6 ) / 6

+ ( x-0 ) * ( x-1 ) * ( x-3 ) * ( x-4 ) / 36

degree Fahrenheit ( x ) = 17*x4/90 - 181*x3/90 + 563*x2/90 - 163*x/30 + 2

By replacing the values of ten for the points the map must go through through ( x=0,1,3,4,6 ) it is easy to see that the look above achieves the consequence, viz. y=2,1,3,0,5 severally.

What happens at other points?

All stakes are off sing the behavior between the fixed points. The multinomial is of degree N and could violently wing off anyplace. The uninterrupted curve for the numerical illustration above is shown below.

hypertext transfer protocol: //local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/curvefit3.gif

A competition in the Mathematics intelligence groups in October 1998

From: `` John Santos '' & lt ; santos_john @ hotmail.com & gt ;

Newsgroups: alt.sci.math.probability, alt.tv.mathnet, aus.mathematics

Capable: $ 100.00 award for the solution

Date: Tue, 15 Sep 1998 20:56:50 -0700

X-Newsreader: Microsoft Outlook Express 4.72.3110.1

X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3

NNTP-Posting-Host: 209.239.197.111

X-NNTP-Posting-Host: 209.239.197.111

Message-ID: & lt ; 35ff36d1.0 @ blushng.jps.net & gt ;

X-NNTP-Posting-Host: 209.63.114.134

Hi everyone,

My name is John Santos and I am willing to pay anyone $ 100.00 for the first

individual to work out this job. I am supplying some intimations. This works as follows:

you will see nine figures - the 10th figure or missive is the reply.

What I need is the expression or mathematical equation to acquire at that place...

Number Answer

-- -- -- -- -- -- -- -- -- -- -- -- -- -

749736637 1

713491024 8

523342792 D

749236871 Phosphorus

727310078 Tocopherol

746261832 4

733237527 L

743510589 9

715240338 K

722592910 1

739627071 Roentgen

The first 1 with the reply and emails it to me wins the $ 100.00

Email reference: santos_john @ hotmail.com

Good Fortune! ! ! !

They refused to pay up for this solution! ! ! !

My answer to this poster was

The followers is the solution to the posted job, although it likely

does n't offer the penetration you are seeking, it surely falls within the

range of competition. To exemplify my solution I will utilize the followers

symbols alternatively of the Numberss you used merely to salvage infinite. For your

2nd column with letters and Numberss use their ASCII values alternatively,

this has no loss of generalization as it is a simple 1 to 1 function.

x1 y1

x2 y2

x3 y3

x4 y4

etc

The followers is a general method of doing a map that passes

through any brace of values ( eleven, Lolo ) .

y1 ( x-x2 ) ( x-x3 ) ( x-x4 )

degree Fahrenheit ( x ) = -- -- -- -- -- -- -- -- -- -- -- -- -- -

( x1-x2 ) ( x1-x3 ) ( x1-x4 )

y2 ( x-x1 ) ( x-x3 ) ( x-x4 )

+ -- -- -- -- -- -- -- -- -- -- -- -- -- -

( x2-x1 ) ( x2-x3 ) ( x2-x4 )

y3 ( x-x1 ) ( x-x2 ) ( x-x4 )

+ -- -- -- -- -- -- -- -- -- -- -- -- -- -

( x3-x1 ) ( x3-x2 ) ( x3-x4 )

y4 ( x-x1 ) ( x-x2 ) ( x-x3 )

+ -- -- -- -- -- -- -- -- -- -- -- -- -- -

( x4-x1 ) ( x4-x2 ) ( x4-x3 )

etc etc. As you can see, at x=x1 all the footings disappear except the

foremost which equals y1, at x=x2 all the footings disappear except the

2nd which equals y2, etc etc.

Ten Yttrium

Number Answer ASCII

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -

749736637 1 49

713491024 8 56

523342792 D 68

749236871 P 80

727310078 E 69

746261832 4 52

733237527 L 76

743510589 9 57

715240338 K 75

722592910 1 49

739627071 R 82

The `` lovely '' look in this instance is

degree Fahrenheit ( x ) =

+ 49 ( ( x - 713491024 ) / 36245613 ) ( ( x - 523342792 ) / 226393845 ) ( ( x - 749236871 ) / 499766 ) ( ( x - 727310078 ) / 22426559 ) ( ( x - 746261832 ) / 3474805 ) ( ( x - 733237527 ) / 16499110 ) ( ( x - 743510589 ) / 6226048 ) ( ( x - 715240338 ) / 34496299 ) ( ( x - 722592910 ) / 27143727 ) ( ( x - 739627071 ) / 10109566 )

+ 56 ( ( x - 749736637 ) / -36245613 ) ( ( x - 523342792 ) / 190148232 ) ( ( x - 749236871 ) / -35745847 ) ( ( x - 727310078 ) / -13819054 ) ( ( x - 746261832 ) / -32770808 ) ( ( x - 733237527 ) / -19746503 ) ( ( x - 743510589 ) / -30019565 ) ( ( x - 715240338 ) / -1749314 ) ( ( x - 722592910 ) / -9101886 ) ( ( x - 739627071 ) / -26136047 )

+ 68 ( ( x - 749736637 ) / -226393845 ) ( ( x - 713491024 ) / -190148232 ) ( ( x - 749236871 ) / -225894079 ) ( ( x - 727310078 ) / -203967286 ) ( ( x - 746261832 ) / -222919040 ) ( ( x - 733237527 ) / -209894735 ) ( ( x - 743510589 ) / -220167797 ) ( ( x - 715240338 ) / -191897546 ) ( ( x - 722592910 ) / -199250118 ) ( ( x - 739627071 ) / -216284279 )

+ 80 ( ( x - 749736637 ) / -499766 ) ( ( x - 713491024 ) / 35745847 ) ( ( x - 523342792 ) / 225894079 ) ( ( x - 727310078 ) / 21926793 ) ( ( x - 746261832 ) / 2975039 ) ( ( x - 733237527 ) / 15999344 ) ( ( x - 743510589 ) / 5726282 ) ( ( x - 715240338 ) / 33996533 ) ( ( x - 722592910 ) / 26643961 ) ( ( x - 739627071 ) / 9609800 )

+ 69 ( ( x - 749736637 ) / -22426559 ) ( ( x - 713491024 ) / 13819054 ) ( ( x - 523342792 ) / 203967286 ) ( ( x - 749236871 ) / -21926793 ) ( ( x - 746261832 ) / -18951754 ) ( ( x - 733237527 ) / -5927449 ) ( ( x - 743510589 ) / -16200511 ) ( ( x - 715240338 ) / 12069740 ) ( ( x - 722592910 ) / 4717168 ) ( ( x - 739627071 ) / -12316993 )

+ 52 ( ( x - 749736637 ) / -3474805 ) ( ( x - 713491024 ) / 32770808 ) ( ( x - 523342792 ) / 222919040 ) ( ( x - 749236871 ) / -2975039 ) ( ( x - 727310078 ) / 18951754 ) ( ( x - 733237527 ) / 13024305 ) ( ( x - 743510589 ) / 2751243 ) ( ( x - 715240338 ) / 31021494 ) ( ( x - 722592910 ) / 23668922 ) ( ( x - 739627071 ) / 6634761 )

+ 76 ( ( x - 749736637 ) / -16499110 ) ( ( x - 713491024 ) / 19746503 ) ( ( x - 523342792 ) / 209894735 ) ( ( x - 749236871 ) / -15999344 ) ( ( x - 727310078 ) / 5927449 ) ( ( x - 746261832 ) / -13024305 ) ( ( x - 743510589 ) / -10273062 ) ( ( x - 715240338 ) / 17997189 ) ( ( x - 722592910 ) / 10644617 ) ( ( x - 739627071 ) / -6389544 )

+ 57 ( ( x - 749736637 ) / -6226048 ) ( ( x - 713491024 ) / 30019565 ) ( ( x - 523342792 ) / 220167797 ) ( ( x - 749236871 ) / -5726282 ) ( ( x - 727310078 ) / 16200511 ) ( ( x - 746261832 ) / -2751243 ) ( ( x - 733237527 ) / 10273062 ) ( ( x - 715240338 ) / 28270251 ) ( ( x - 722592910 ) / 20917679 ) ( ( x - 739627071 ) / 3883518 )

+ 75 ( ( x - 749736637 ) / -34496299 ) ( ( x - 713491024 ) / 1749314 ) ( ( x - 523342792 ) / 191897546 ) ( ( x - 749236871 ) / -33996533 ) ( ( x - 727310078 ) / -12069740 ) ( ( x - 746261832 ) / -31021494 ) ( ( x - 733237527 ) / -17997189 ) ( ( x - 743510589 ) / -28270251 ) ( ( x - 722592910 ) / -7352572 ) ( ( x - 739627071 ) / -24386733 )

+ 49 ( ( x - 749736637 ) / -27143727 ) ( ( x - 713491024 ) / 9101886 ) ( ( x - 523342792 ) / 199250118 ) ( ( x - 749236871 ) / -26643961 ) ( ( x - 727310078 ) / -4717168 ) ( ( x - 746261832 ) / -23668922 ) ( ( x - 733237527 ) / -10644617 ) ( ( x - 743510589 ) / -20917679 ) ( ( x - 715240338 ) / 7352572 ) ( ( x - 739627071 ) / -17034161 )

+ 82 ( ( x - 749736637 ) / -10109566 ) ( ( x - 713491024 ) / 26136047 ) ( ( x - 523342792 ) / 216284279 ) ( ( x - 749236871 ) / -9609800 ) ( ( x - 727310078 ) / 12316993 ) ( ( x - 746261832 ) / -6634761 ) ( ( x - 733237527 ) / 6389544 ) ( ( x - 743510589 ) / -3883518 ) ( ( x - 715240338 ) / 24386733 ) ( ( x - 722592910 ) / 17034161 )

degree Fahrenheit ( 749736637 ) = 49 ( 1 )

degree Fahrenheit ( 713491024 ) = 56 ( 8 )

degree Fahrenheit ( 523342792 ) = 68 ( D )

degree Fahrenheit ( 749236871 ) = 80 ( P )

degree Fahrenheit ( 727310078 ) = 69 ( E )

degree Fahrenheit ( 746261832 ) = 52 ( 4 )

degree Fahrenheit ( 733237527 ) = 76 ( L )

degree Fahrenheit ( 743510589 ) = 57 ( 9 )

degree Fahrenheit ( 715240338 ) = 75 ( K )

degree Fahrenheit ( 722592910 ) = 49 ( 1 )

degree Fahrenheit ( 739627071 ) = 82 ( R )

Updated: Aug 11, 2021
Cite this page

A Study Of Different Interpolation Methods Computer Science Essay. (2020, Jun 01). Retrieved from https://studymoose.com/a-study-of-different-interpolation-methods-computer-science-new-essay

A Study Of Different Interpolation Methods Computer Science Essay essay
Live chat  with support 24/7

👋 Hi! I’m your smart assistant Amy!

Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.

get help with your assignment