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

Software that outputs a general polynomial formula for a finite series

  1. Oct 1, 2007 #1
    Is there a tool that spits out a general polynomial formula for an input consisting of a finite sequence, e.g.:

    you type in
    1 ,3 , 5, 7

    the program processes the input and spits out
    (n+2), 7>=n>=1
  2. jcsd
  3. Oct 2, 2007 #2
    I would think that a polynomial formula would be more like 2n-1 or 2n+1. If you are looking for a general recursive formula that is another animal. There is a web site that provides that also, but I don't have the link offhand. Also it wouldn't make much sense to spit out the lower and higher boundary points of your entry.
  4. Oct 2, 2007 #3
    Here. I was bored.
    When given these inputs, the outputs are:

    0 1 4 9 16
    n^2 , n=0..4​
    80 5 30
    50n^2 - 125n + 80 , n=0..2​
    4 3 2 1
    - n + 4 , n=0..3​

    C source only.

    Attached Files:

    • poly.zip
      File size:
      881 bytes
  5. Oct 2, 2007 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    I'm bored but not yet intrigued, so I didn't look at Dodo's boring zip file. I assume he encoded Newton's forward difference formula, http://mathworld.wolfram.com/NewtonsForwardDifferenceFormula.html.

    I'm bored because I'm supposed to be writing a proposal. If I let myself become sufficiently intrigued I will have to stay up all night to finish the proposal. On top of this, I have an 8:30 AM meeting tomorrow that I can't skip.
  6. Oct 3, 2007 #5
    i think this is what you're asking, i learned this in linear algebra. it's not the program but it's a method from which a program shouldn't be hard to come up with. i haven't done this in a while, and my notation is going to be messy.

    you have a finite sequence of n elements A1, A2,...An. Then you consider them as ordered pairs (1,A1), (2,A2),...(n,An). To get a general n-1th degree polynomial

    y = C1 + C2x +...+Cnx^(n-1) and then plug in some values and solve the linear equation.

    to do your sequence for example 1,3,5,7. put them in ordered pairs (1,1) (2,3) (3,5) (4,7).

    1 = C1 + C2(1) + C3(1) + C4(1)
    3 = C1 + C2(2) + C3(4) + C4(8)
    5 = C1 + C2(3) + C3(9) + C4(27
    7 = C1 + C2(4) + C3(16) + C4(64)

    4 equations, 4 unknowns, and i ended up with the polynomial

    y = 2x - 1 x= 4,3,2,1.

    just in case it isn't clear, Ck is the coefficient of x^(k-1).

    if i understood, that's what you're looking for.
    Last edited: Oct 3, 2007
  7. Oct 11, 2010 #6
    I wrote such a program and put it online. I originally developed this method based on my independent analysis of series in high school in the early 70s. As others have mentioned it does rely on the forward distance (although, at the time, I had no idea that's what it was called).

    It takes about 20 lines of code to implement (including documentation) in PHP.

    http://bentley.110mb.com/?test:series [Broken]
    Last edited by a moderator: May 5, 2017
  8. Oct 11, 2010 #7
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Software outputs general
A What separates Hilbert space from other spaces?