Results 1 to 2 of 2

Math Help - Pn(x) Polynomial fitting

  1. #1
    Newbie
    Joined
    Nov 2012
    From
    Malaysia
    Posts
    2

    Pn(x) Polynomial fitting

    Hello, out there! I am Samuel.

    Please, I need your assistance to fit the following set of data points with a polynomial (could be Newtons divided difference polynomial):

    i 0 1 2 3 4 5 6 7 8 9 01 11
    xi 0.005 0.01 0.02 0.03 0.05 0.1 0.2 0.3 0.4 0.6 0.8 1.0
    f(xi) 0.376 0.41 0.428 0.486 0.537 0.624 0.556 0.512 0.450 0.378 0.274 0.106

    I need the polynomial to pass through all the data points.

    Looking forward to your kind response.

    Thanks.

    Last edited by saayo3; November 24th 2012 at 10:06 PM. Reason: Additional information
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Senior Member jakncoke's Avatar
    Joined
    May 2010
    Posts
    388
    Thanks
    80

    Re: Pn(x) Polynomial fitting

    Here. I'll create a polynomial that passes through for your first three points

    .005 f(.005) = .376
    .01 f(.01) .41
    .02 f(.02) = .428

    Since we have 3 points, assume that there exists a polynomial  p(x) = a_2 x^2 + a_1 x + a_0 such that  p(x_i) = f(x_i) . Then
    p(.005) =  a_2 (.005)^2 + a_1 (.005) + a_0 = .376
    p(.01) =  a_2 (.01)^2 + a_1 (.01) + a_0 = .41
    p(.02) =  a_2 (.02)^2 + a_1 (.02) + a_0 = .428

    What we get is a system of linear equations with 3 unknowns and 3 equations.
    \begin{bmatrix} (.005)^2 & (.005) & 1\\ (.01)^2 & (.01) & 1 \\ (.02)^2 & (.02) & 1 \end{bmatrix} \begin{bmatrix} a_2 \\ a_1 \\ a_0 \end{bmatrix} = \begin{bmatrix} .376 \\ .41 \\ .428 \end{bmatrix}

    So solving, i get  a_2 =  -333.33  a_1 = 11.8 and  a_0 = .325 .

    So our polynomial is  p(x) =  -333.33x^2 + 11.8x + .325

    So verification
     p(.005) = -333.33(.005)^2 + 11.8(.005) + .325 = .376
     p(.01) = -333.33(.01)^2 + 11.8(.01) + .325 = .41
     p(.02) = -333.33(.02)^2 + 11.8(.02) + .325 = .428

    So There ya go. Just do this for all your data points and use this linear solver linked below to get the coefficients.
    Linear solver


    The linear solver seems to be able to only solve 9 linear equations in 9 variables. So i got for the first 9 points
    -400000000.0x^8 + 438999999.99999994x^7 + -180000000.0x^6 + 34700000.0x^5 + -3319243.63x^4 + 156177.88x^3 + -3498.67x^2 + 37.53x^1 + 0.26x^0 +

    Here are the test results
    Got Value p(x_i): 0.38 Expected Value f(x_i): 0.376
    Got Value p(x_i): 0.41 Expected Value f(x_i): 0.41
    Got Value p(x_i): 0.43 Expected Value f(x_i): 0.428
    Got Value p(x_i): 0.49 Expected Value f(x_i): 0.486
    Got Value p(x_i): 0.53 Expected Value f(x_i): 0.537
    Got Value p(x_i): 0.18 Expected Value f(x_i): 0.624
    Got Value p(x_i): -14.35 Expected Value f(x_i): 0.556
    Got Value p(x_i): -106.13 Expected Value f(x_i): 0.512
    Got Value p(x_i): -360.17 Expected Value f(x_i): 0.450

    As you can see every data point added makes the polynomial error grow at a very large rate, i guess that is to be expected
    Last edited by jakncoke; November 25th 2012 at 03:28 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Curve fitting nonlinear polynomial
    Posted in the Differential Geometry Forum
    Replies: 8
    Last Post: November 6th 2012, 08:32 AM
  2. fitting polynomial functions into data
    Posted in the Algebra Forum
    Replies: 1
    Last Post: April 21st 2010, 01:37 PM
  3. Polynomial Curve Fitting, Matrices
    Posted in the Advanced Algebra Forum
    Replies: 2
    Last Post: February 6th 2010, 05:13 AM
  4. [SOLVED] Polynomial Curve Fitting
    Posted in the Advanced Algebra Forum
    Replies: 4
    Last Post: September 6th 2009, 10:43 AM
  5. Polynomial Fitting? Regression?
    Posted in the Pre-Calculus Forum
    Replies: 0
    Last Post: March 2nd 2009, 10:59 AM

Search Tags


/mathhelpforum @mathhelpforum