Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Linear Interpolation

  • 04-05-2011 11:43am
    #1
    Registered Users, Registered Users 2 Posts: 2,103 ✭✭✭


    Hi folks,

    Hoping someone can help me. I'm working on financial maths at the mo, trying to find an interest rate.

    I have two values (I know the true value is somewhere in between) and a function.

    I have to interpolate, using x3 = x2 - f(x2)*((x1-x2)/(f(x1)-f(x2)).

    x1 is 0.095, x2 is 0.1, f(x1) is -2.90047144 and f(x2) is 0.4318556042.

    The answer is approx 0.0997, but I can't get it - I keep getting 0.004 :mad:

    Can anyone tell me maybe where I'm going wrong?


Comments

  • Registered Users, Registered Users 2 Posts: 2,481 ✭✭✭Fremen


    You sure that formula is correct?

    http://en.wikipedia.org/wiki/Linear_interpolation

    Your x1 is wikipedia's x0, your f(x1) is wikipedia's y0.
    Your x2 is wikipedia's x1, your f(x2) is wikipedia's y1.

    The equation in wikipedia gives the formula for any point on the line joining the two points. I guess you want to set x3 (using your notation) to be half way between x1 and x2 (this is x in wiki notation). You're then looking for f(x3) (y in wiki notation), which is given by the formula in wikipedia.


  • Registered Users, Registered Users 2 Posts: 2,103 ✭✭✭misslt


    My formula probably is wrong.

    Great.

    Well at least I know what I'm doing wrong.

    Thanks!


Advertisement