Is it possible to interpolate between two polynomials?

In summary, Joe is seeking help with interpolating between two polynomials. His attempts at using the divided difference method produced a polynomial similar to what he wants, but it is clearly wrong. He has attached pictures to illustrate his issue and it is suggested that he divides the intervals along the "x" axis rather than the "y" axis. Joe is looking for a simpler way to do this and is considering inverting his equations to calculate Flow for a given Pressure.
  • #1
GB_Joe
5
0
Hi everyone! Having spent many fruitless hours Googling this I stumbled upon this forum, and am hoping you may be able to help...

I'm looking for a way to interpolate between two polynomials. These two lines are related and run along in a near-parallel fashion, and I want to divide the gap between them into 5 equal parts. I can do it by creating a table of values, but really I want to be able to create an equation directly. Simply dividing up the difference between the coefficients produces something which looks close to what I want (it's a similar shape and lies between the original two lines), but is clearly wrong.

Am I making sense?!? Does anyone have any ideas, or do I need to provide more detail? Am I even in the right forum?

Cheers,
Joe.
 
Mathematics news on Phys.org
  • #2
GB_Joe said:
Hi everyone! Having spent many fruitless hours Googling this I stumbled upon this forum, and am hoping you may be able to help...

I'm looking for a way to interpolate between two polynomials. These two lines are related and run along in a near-parallel fashion, and I want to divide the gap between them into 5 equal parts. I can do it by creating a table of values, but really I want to be able to create an equation directly. Simply dividing up the difference between the coefficients produces something which looks close to what I want (it's a similar shape and lies between the original two lines), but is clearly wrong.

Am I making sense?!? Does anyone have any ideas, or do I need to provide more detail? Am I even in the right forum?

Cheers,
Joe.
Using the divided difference produced a polynomial similar to what you want, but you say it is clearly wrong. You need to elaborate, i.e. why is it wrong?
 
  • #3
Okay!

My two starting polynomials both go to f(x) = 0 at the maximum limit of x. My attempts at interpolation all go down well below 0.

I've attached a couple of pics to make it easier to understand. The first shows simple interpolation of values, all nice and neat, just what you'd expect. The second is done by interpolating the coefficients. This shows it pretty clearly - they're not a million miles away, but they're obviously not right.

Incidentally, there's no convergence between the two methods at the top end, although it's not so obvious from the pics. You can see it if you flick between them.

I guess I'm surprised that the error is greatest at f(x)=0... but I'm coming at this from a very non-scientific angle, and I clearly don't know what I'm doing!

Cheers, and thanks for replying,
Joe.
 

Attachments

  • interpolate1.png
    interpolate1.png
    7.2 KB · Views: 761
  • interpolate2.png
    interpolate2.png
    8 KB · Views: 748
  • #4
I couldn't access your attachments.
 
  • #5
Just as there are many different ways to interpolate between two numbers, there are many different ways to interpolate functions.

Typically, what we do is talk about a "homotopy" which is a function, [itex]\phi(x, t)[/itex], with t between and 1, continuous in both variables, such that [itex]\phi(x,0)= f_0(x)[/itex] and [itex]\phi(x, 1)= f_1(x)[/itex].
 
Last edited by a moderator:
  • #6
I don't know if you're still here Joe, but now that those attachments are visible it is clear that the one you're doing manually (blue) is dividing the intervals along the "x" axis while the one you're doing via the coefficients (red) is (as expected) dividing the intervals along the "y" axis.

Can you explain why one (equal divisions along x axis) is preferable to the other (equal divisions along y axis)?
 
  • #7
@ uart:

I am still here! Sorry, I'm a part-timer, looking after the kids Weds. and Thurs. so try to avoid thinking about work then!

Now that you've said it, it's obvious... thank you! The reason that one is right is that division across the x-axis is what you get by experiment. These are performance curves for variable-pitch fans, Volume Flow along the x-axis and Static Pressure along y. We have pretty much infinite combinations we can set them to, so we can't test everything, and I need a way to manipulate the equations rather than data values.

Is it even possible to interpolate along x in this way?

@ HallsofIvy:

:rolleyes:
That, my friend, is going to need a whole lot of unpacking... it's been a looooong time since I did any real maths, and I was rubbish even then...! Please don't be concerned about patronising me, start off by assuming I'm an idiot, I won't take offence!

Thanks to all for your help so far!
Joe.
 
Last edited:
  • #8
Okay then...

I think I may have figured this out, but it's pretty long-winded. Do you think there's a simpler way to do this?

If we say the lower curve is "15" and the upper is "20", the interpolated ones are 16...19.

So, [itex]x_{16} = (4x_{15}+x_{20})/5[/itex]

and [itex]f(x_{16})=(4f(x_{15})+f(x_{20}))/5[/itex]

and so on.

Well, it doesn't look so bad when you write it out like that... and computers are good at this calculation stuff, aren't they?!?

Joe.
 
  • #9
GB_Joe said:
Okay then...

I think I may have figured this out, but it's pretty long-winded. Do you think there's a simpler way to do this?

If we say the lower curve is "15" and the upper is "20", the interpolated ones are 16...19.

So, [itex]x_{16} = (4x_{15}+x_{20})/5[/itex]

and [itex]f(x_{16})=(4f(x_{15})+f(x_{20}))/5[/itex]

and so on.

Well, it doesn't look so bad when you write it out like that... and computers are good at this calculation stuff, aren't they?!?

Joe.

No that will ultimately just get you the red curve again.

If you're sure that the blue curve is the one that has the correct physical meaning for your application then there's really no other way than inverting your equations (either algebraically or numerically), so that you can calculate Flow for a given Pressure rather than the other way around.

Like this for example.

- For a given Pressure find Flow_15 and Flow_20.

- Now form Flow_16 = 0.8 Flow_15 + 0.2 Flow20 and so on.

These are your new x values all corresponding to the same value of y (as in "for a given pressure" in the first step). You have to repeat this for each different pressure level that you wish to plot.
 
  • #10
No that will ultimately just get you the red curve again.

Well... it didn't!:confused:

I've ended up with identical data values to when I produced the blue curves.

Initially I did get the same as the red curves, but I was using values of [itex]x_{16}[/itex] in the second equation instead of [itex]x_{15}[/itex] and [itex]x_{20}[/itex].

I don't trust my maths enough to do this kind of thing theoretically, which is why I always end up producing curves and stuff, but it seems to have done the trick!
 

FAQ: Is it possible to interpolate between two polynomials?

Can you explain what interpolation between two polynomials means?

Interpolation between two polynomials refers to the process of finding a polynomial function that fits between two given polynomials. This allows for the estimation of values between the given polynomials, rather than just at the data points themselves.

How is interpolation between two polynomials different from extrapolation?

Interpolation between two polynomials involves estimating values within the given data range, while extrapolation involves estimating values outside of the given data range. Interpolation is generally considered more reliable and accurate than extrapolation.

What are some common methods for interpolating between two polynomials?

Some common methods for interpolating between two polynomials include Lagrange interpolation, Newton interpolation, and spline interpolation. Each method has its own advantages and may be more suitable for certain types of data.

Is it always possible to interpolate between two polynomials?

In theory, it is possible to interpolate between two polynomials. However, the accuracy and reliability of the interpolation method may vary depending on the data and the chosen interpolation method. In some cases, it may be difficult or impossible to find a polynomial function that fits perfectly between two given polynomials.

Can interpolation between two polynomials be used for any type of data?

Interpolation between two polynomials can be used for a variety of data types, including numerical, categorical, and time series data. However, the effectiveness of the interpolation method may vary depending on the type and characteristics of the data.

Similar threads

Replies
3
Views
1K
Replies
4
Views
790
Replies
20
Views
1K
Replies
7
Views
4K
Replies
1
Views
1K
Replies
16
Views
6K
Back
Top