What are some algorithms for finding a closed form function given an integer sequence?

后端 未结 7 962
刺人心
刺人心 2020-12-30 14:58

I\'m looking form a programatic way to take an integer sequence and spit out a closed form function. Something like:

Given: 1,3,6,10,15

Return: n(n+1)/2

相关标签:
7条回答
  • 2020-12-30 15:09

    This touches an extremely deep, sophisticated and active area of mathematics. The solution is damn near trivial in some cases (linear recurrences) and damn near impossible in others (think 2, 3, 5, 7, 11, 13, ....) You could start by looking at generating functions for example and looking at Herb Wilf's incredible book (cf. page 1 (2e)) on the subject but that will only get you so far.

    But I think your best bet is to give up, query Sloane's comprehensive Encyclopedia of Integer Sequences when you need to know the answer, and instead spend your time reading the opinions of one of the most eccentric personalities in this deep subject.

    Anyone who tells you this problem is solvable is selling you snake oil (cf. page 118 of the Wilf book (2e).)

    0 讨论(0)
  • 2020-12-30 15:12

    The Axiom computer algebra system includes a package for this purpose. You can read its documentation here.

    Here's the output for your example sequence in FriCAS (a fork of Axiom):

    (3) -> guess([1, 3, 6, 10, 15])
    
                     2
                    n  + 3n + 2
    (3)  [[function= -----------,order= 0]]
                         2
    Type: List(Record(function: Expression(Integer),order: NonNegativeInteger))
    
    0 讨论(0)
  • 2020-12-30 15:12

    I think your problem is ill-posed. Given any finite number of integers in a sequence with no generating function, the next element can be anything.

    You need to assume something about the sequence. Is it geometric? Arithmetic?

    0 讨论(0)
  • 2020-12-30 15:14

    There is no general answers; a simple method can be implemented bu using Pade approximants; in two words, assume your sequence is a sequence of coefficients of the Taylor expansion of an unknown function, then apply an algorithm (similar to the continued-fraction algorithm) in order to "simplify" this Taylor-expansion (more precisely: find a rational function very close to the initial (and truncated) function. The Maxima program can do it: look at "pade" on the page: http://maxima.sourceforge.net/docs/manual/maxima_28.html

    Another answer tells about the "guess" package in the FriCAS fork of Axiom (see previous answer by jmbr). If I am not wrong; this package is itself inspired from the Rate program by Christian Krattenthaler; you can find it here: http://www.mat.univie.ac.at/~kratt/rate/rate.html Maybe looking at its source could tell you about other methods.

    0 讨论(0)
  • 2020-12-30 15:15

    If your sequence comes from a polynomial then divided differences will find that polynomial expressed in terms of the Newton basis or binomial basis. See this.

    0 讨论(0)
  • 2020-12-30 15:25

    If your data is guaranteed to be expressible as a polynomial, I think you would be able to use R (or any suite that offers regression fitting of data). If your correlation is exactly 1, then the line is a perfect fit to describe the series.

    There's a lot of statistics that goes into regression analysis, and I am not familiar enough with even the basics of calculation to give you much detail.

    But, this link to regression analysis in R might be of assistance

    0 讨论(0)
提交回复
热议问题