# Failures in rsolve_hyper from test_rsolve_bulk() #7055

Closed
opened this Issue Jul 28, 2013 · 0 comments

Projects
None yet
4 participants
Contributor

### skirpichev commented Jul 28, 2013

 ``````I had observed a lot of wrong answers from rsolve_hyper() after uncommenting the "if p.is_hypergeometric(n)" branch in the file test_recurr.py. For example: In [12]: def recurrence_term(c, f): ....: """Compute RHS of recurrence in f(n) with coefficients in c.""" ....: return sum(c[i]*f.subs(n, n + i) for i in range(len(c))) ....: In [13]: f=Function('f') In [14]: c=[-2, 1] In [15]: p=n In [16]: q=recurrence_term(c, p) In [17]: s=rsolve_hyper(c, q, n) In [18]: s Out[18]: n 2 ⋅C₀ + C₀⋅(-n + 1) In [19]: eq=Eq(sum(c[i]*f(n + i) for i in range(len(c))),q) In [20]: eq Out[20]: -2⋅f(n) + f(n + 1) = -n + 1 In [21]: k=Symbol('k',integer=True) In [22]: eq.subs(f,Lambda(k,s.subs(n,k))).simplify() Out[22]: C₀⋅(n - 2) = -n + 1 Mathematica's answer: In[9]:= (f[n]/.RSolve[-2 f[n] + f[n + 1] == -n + 1,f[n],n])[[1]] Out[9]= n -2 + 2 n -1 + n --------- + 2 C[1] 2 `````` Original issue for #7055: http://code.google.com/p/sympy/issues/detail?id=3956 Original author: https://code.google.com/u/113518207426301808764/

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 21, 2016

``` Fix reference to issue sympy/sympy#7055 (added in d7b52cb) ```
``` c4ffcd1 ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 24, 2016

``` Build correct inhomogeneous solution in rsolve_hyper ```
```Use rsolve_ratio instead.

Fixes diofant#294

Closes sympy/sympy#11261
Closes sympy/sympy#7055```
``` de7cf5a ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 25, 2016

``` Build correct inhomogeneous solution in rsolve_hyper ```
```Use rsolve_ratio instead.  (If it returns a generic
solution - we substitute back 0's for symbols in one.)

Fixes diofant#294

Closes sympy/sympy#11261
Closes sympy/sympy#7055```
``` 5d84b3d ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 26, 2016

``` Build correct inhomogeneous solution in rsolve_hyper ```
```Use rsolve_ratio instead.  (If it returns a generic
solution - we substitute back 0's for symbols in one.)

Fixes diofant#294

Closes sympy/sympy#11261
Closes sympy/sympy#7055```
``` da9789c ```