Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Is it possible to interpolate between two polynomials?

  1. Feb 8, 2010 #1
    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???

  2. jcsd
  3. Feb 8, 2010 #2


    User Avatar
    Science Advisor

    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?
  4. Feb 9, 2010 #3

    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,

    Attached Files:

  5. Feb 9, 2010 #4


    User Avatar
    Science Advisor

    I couldn't access your attachments.
  6. Feb 10, 2010 #5


    User Avatar
    Science Advisor

    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: Feb 13, 2010
  7. Feb 10, 2010 #6


    User Avatar
    Science Advisor

    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)?
  8. Feb 12, 2010 #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:

    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!
    Last edited: Feb 12, 2010
  9. Feb 12, 2010 #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?!?

  10. Feb 12, 2010 #9


    User Avatar
    Science Advisor

    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.
  11. Feb 16, 2010 #10
    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!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook