Repository: sympy/sympy

Issue:
limit(fibonacci(n + 1)/fibonacci(n), n, oo) does not give GoldenRatio
```
In [84]: limit(fibonacci(n + 1)/fibonacci(n), n, oo)
Out[84]:
    fibonacci(n + 1)
lim ────────────────
n─→∞  fibonacci(n)
```

The answer should be `GoldenRatio`.


Discussion:

Patch:
diff --git a/sympy/core/function.py b/sympy/core/function.py
index a5910a9f87..62d45d01ad 100644
--- a/sympy/core/function.py
+++ b/sympy/core/function.py
@@ -812,7 +812,7 @@ def _eval_as_leading_term(self, x, logx=None, cdir=0):
             raise NotImplementedError(
                 '%s has no _eval_as_leading_term routine' % self.func)
         else:
-            return self.func(*args)
+            return self
 
 
 class AppliedUndef(Function):
diff --git a/sympy/functions/combinatorial/numbers.py b/sympy/functions/combinatorial/numbers.py
index df0fa1ebd4..1f52d9fe13 100644
--- a/sympy/functions/combinatorial/numbers.py
+++ b/sympy/functions/combinatorial/numbers.py
@@ -261,6 +261,10 @@ def eval(cls, n, sym=None):
                        "only for positive integer indices.")
                 return cls._fibpoly(n).subs(_sym, sym)
 
+    def _eval_rewrite_as_tractable(self, n, **kwargs):
+        from sympy.functions import sqrt, cos
+        return (S.GoldenRatio**n - cos(S.Pi*n)/S.GoldenRatio**n)/sqrt(5)
+
     def _eval_rewrite_as_sqrt(self, n, **kwargs):
         from sympy.functions.elementary.miscellaneous import sqrt
         return 2**(-n)*sqrt(5)*((1 + sqrt(5))**n - (-sqrt(5) + 1)**n) / 5


Test patch:
diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py
index 7f34e56fef..8767aa88f3 100644
--- a/sympy/series/tests/test_limits.py
+++ b/sympy/series/tests/test_limits.py
@@ -2,11 +2,12 @@
 
 from sympy.concrete.summations import Sum
 from sympy.core.function import (Function, diff)
-from sympy.core import EulerGamma
+from sympy.core import EulerGamma, GoldenRatio
 from sympy.core.mod import Mod
 from sympy.core.numbers import (E, I, Rational, oo, pi, zoo)
 from sympy.core.singleton import S
 from sympy.core.symbol import (Symbol, symbols)
+from sympy.functions.combinatorial.numbers import fibonacci
 from sympy.functions.combinatorial.factorials import (binomial, factorial, subfactorial)
 from sympy.functions.elementary.complexes import (Abs, re, sign)
 from sympy.functions.elementary.exponential import (LambertW, exp, log)
@@ -776,6 +777,10 @@ def test_issue_9471():
     assert limit(((27**(log(n,3)+1))/n**3),n,oo) == 27
 
 
+def test_issue_10382():
+    assert limit(fibonacci(n + 1)/fibonacci(n), n, oo) == GoldenRatio
+
+
 def test_issue_11496():
     assert limit(erfc(log(1/x)), x, oo) == 2