Searches for an element of the algebra which annihilates the given data.
INPUT:
Optional arguments:
OUTPUT:
An error is raised if no such element is found.
Note
This method is designed to find equations for D-finite objects. It may exhibit strange behaviour for objects which are holonomic but not D-finite.
EXAMPLES:
sage: rec = guess([(2*i+1)^15 * (1 + 2^i + 3^i)^2 for i in xrange(1000)], OreAlgebra(ZZ['n'], 'Sn'))
sage: rec.order(), rec.degree()
(6, 90)
sage: R.<t> = QQ['t']
sage: rec = guess([1/(i+t) + t^i for i in xrange(100)], OreAlgebra(R['n'], 'Sn'))
sage: rec
((t - 1)*n^2 + (2*t^2 + t - 2)*n + t^3 + 2*t^2)*Sn^2 + ((-t^2 + 1)*n^2 + (-2*t^3 - 3*t^2 + 2*t + 1)*n - t^4 - 3*t^3 - t^2 + t)*Sn + (t^2 - t)*n^2 + (2*t^3 - t)*n + t^4 + t^3 - t^2
Shortcut for guess applied with an Ore algebra of differential operators in \(D\) over \(K[x]\) where \(K\) is the parent of data[0].
See the docstring of guess for further information.
Shortcut for guess applied with an Ore algebra of \(q\)-recurrence operators in \(Q\) over \(K[qn]\) where \(K\) is the parent of \(q\).
See the docstring of guess for further information.
Guesses recurrence or differential equations for a given sample of terms.
INPUT:
OUTPUT:
A basis of the K-vector space of all the operators \(L\) in A of order at most order and degree at most degree such that \(L\) applied to data gives an array of zeros. (resp. \(L\) applied to the truncated power series with data as terms gives the zero power series)
An error is raised in the following situations:
ALGORITHM:
Ansatz and linear algebra.
Note
This is a low-level method. Don’t call it directly unless you know what you are doing. In usual applications, the right method to call is guess.
EXAMPLES:
sage: K = GF(1091); R.<n> = K['n']; A = OreAlgebra(R, 'Sn')
sage: data = [(5*n+3)/(3*n+4)*fibonacci(n)^3 for n in xrange(200)]
sage: guess_raw(data, A, order=5, degree=3, lift=K)
[(n^3 + 546*n^2 + 588*n + 786)*Sn^5 + (356*n^3 + 717*n^2 + 381*n + 449)*Sn^4 + (8*n^3 + 569*n^2 + 360*n + 214)*Sn^3 + (31*n^3 + 600*n^2 + 784*n + 287)*Sn^2 + (1078*n^3 + 1065*n^2 + 383*n + 466)*Sn + 359*n^3 + 173*n^2 + 503, (n^3 + 1013*n^2 + 593*n + 754)*Sn^5 + (797*n^3 + 56*n^2 + 7*n + 999)*Sn^4 + (867*n^3 + 1002*n^2 + 655*n + 506)*Sn^3 + (658*n^3 + 834*n^2 + 1036*n + 899)*Sn^2 + (219*n^3 + 479*n^2 + 476*n + 800)*Sn + 800*n^3 + 913*n^2 + 280*n]
Shortcut for guess applied with an Ore algebra of shift operators in \(S\) over \(K[n]\) where \(K\) is the parent of data[0].
See the docstring of guess for further information.