-1

For example, there's the archetypical Fibonacci sequence, which can be defined as

$$ \begin{align} F(0) &= 0\\ F(1) &= 1\\ F(n) &= F(n-1) + F(n-2). \end{align} $$

The only continuous function F that satisfies the above system of equations is, as we probably all know,

$$ F(n) = \frac{\varphi^n - \psi^{n}}{\sqrt{5}}, $$

where $\varphi$ is the golden ratio and $\psi=-\varphi^{-1}$. This solution even holds for negative values of n.

My question is this: is there a method for deriving a continuous function only given a valid set of equations referencing said function? Or alternatively the set of functions satisfying a system of equations?

I suspect the answer is yes, since functional declarative programming languages like Haskell can say things such as

fib :: Integer -> Integer
fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)

However, Haskell is able to do this in a generalised way for almost any valid function defined naïvely in this form. How exactly it achieves this eludes me, however.

Vlad
  • 51
  • 1
    Welcome to MSE ^_^. What do you mean by "continuous"? It looks like you're still defining $F$ on the integers. Perhaps you're looking for a closed form for recursively defined functions? As it stands, I don't fully understand what you're asking. – Chris Grossack Jan 19 '22 at 19:52
  • 1
    It's worth noting that your haskell code will run extremely slowly (in fact, exponentially slowly) because in the process of computing $F(n)$, it computes (multiple times!) all of the $F(k)$ for $k < n$. So I'm not sure how it's any more of a "continuous function" than your original recursive definition. – Chris Grossack Jan 19 '22 at 19:54
  • See https://math.stackexchange.com/questions/4205834/how-to-solve-linear-recurrence-relations-with-constant-coefficients – zwim Jan 19 '22 at 19:58
  • @HallaSurvivor Hm, the third equation technically still holds for all real (and complex) numbers, but I can see how you can never get to a complex result only given $F_0=0$ and $F_1=1$, so yeah you can ignore that part. – Vlad Jan 19 '22 at 20:03
  • @HallaSurvivor Also I wasn't aware of that fact about Haskell, I had been led to believe that the extreme recursion can be optimised away by the compiler with the right flags somehow. – Vlad Jan 19 '22 at 20:04
  • @zwim Interesting, this seems to be what I was looking for. Thank you! – Vlad Jan 19 '22 at 20:09
  • So are you asking when we can extend a function $F : \mathbb{N} \to \mathbb{R}$ (defined recursively) to a continuous function $\tilde{F} : \mathbb{R} \to \mathbb{R}$? If you only want continuous, this is always true -- we can just linearly interpolate between the known integer values. Even if you want more, smooth for instance, we can still do it, we just need to be slightly smarter with how we interpolate. See here for instance. – Chris Grossack Jan 19 '22 at 20:10
  • From your response to @zwim, it looks like you're trying to solve recurrences. One standard technique (which is very flexible) is via generating functions. You can read more about solving recurrences with this technique in the (excellent) book generatingfunctionology, available for free here. You should be warned, though. In general it's not possible to find nice closed forms for recurrences. Even something as simple as $F(n) = F(n-1)^2 + 1$ doesn't have a closed form, as far as we know. – Chris Grossack Jan 19 '22 at 20:14
  • Well, not exactly (and I believe the type of the recursively defined function is $\mathbb Z \to\mathbb Z$, and the type of the actual continuous function can be said to be $\mathbb C \to\mathbb C$) I think I'm just extremely bad at formulating myself as I don't have a formal background in mathematics, haha. I guess what I meant to ask, in computer scientific terms, is just "is there a generalised algorithm that spits out a function given a set of constraints on that function?" – Vlad Jan 19 '22 at 20:16
  • 1
    Then I'm afraid the answer is "no" as soon as the constraints become complicated in any reasonable sense. If you restrict attention to linear recurrences then the answer is "yes", and in fact this has been done. See here for documentation on a very flexible recurrence solver that works in many cases. Unfortunately, it's still totally open to compute even asymptotics for general recurrences! – Chris Grossack Jan 19 '22 at 20:24
  • 1
    In the worst case, this problem is undecidable in the formal sense. Indeed, John Conway showed that any computer program can be coded up as a "function with constraints" analogous to the collatz function, see fractran for more. – Chris Grossack Jan 19 '22 at 20:27
  • @HallaSurvivor Is this open even in the case of polynomial recurrences with real coefficients ? Since it seems that the author has such recurrences in mind , not collatz-like recurrences. – Peter Jan 19 '22 at 20:54
  • I have also an example in my answers of a relation defined on integers which is then extended to the reals by density and continuity --> https://math.stackexchange.com/questions/4278239/generalized-mergesort-time-complexity-functional-equation-fn-2f-left-fracn/4278301#4278301 – zwim Jan 19 '22 at 21:01
  • @Peter -- the undecidability result is only for collatz like sequences, but I included it "in the worst case" because I still don't really understand how general a class of problems OP wants to solve. That said, as far as I know it's still open to find asymptotics for recurrences with polynomial coefficients. See here – Chris Grossack Jan 19 '22 at 22:10
  • @HallaSurvivor thank you very much for the concise answer and provided resources! I'd give you a tick mark if I could. – Vlad Jan 19 '22 at 23:39
  • I'll make my response an answer, then ^_^ – Chris Grossack Jan 19 '22 at 23:44

2 Answers2

1

You claim that

The only continuous function F that satisfies the above system of equations is, as we probably all know, $$ F(n) = \frac{\varphi^n - \psi^{n}}{\sqrt{5}}, $$

This claim in false even if $\,F\,$ is restricted to real functions. Given any integer $\,k,\,$ define the confinuous complex function $$ F_k(x) := e^{2\pi i k x}\frac{\varphi^x - \psi^{x}}{\sqrt{5}}. $$ It is easy to verify that it satisfies the initial conditions $\, F_k(0) = 0, \;\; F_k(1) = 1\,$ and the recursion $$ F_k(x) = F_k(x-1) + F_k(x-2). $$ The real part of $\,F_k(x)\,$ also satisfies the above conditions.

In general, given any real continuous function $\,f(x)\,$ defined on the interval $\,[0,2)\,$ with $\,f(0)=0,\,$ and $\,f(1)=1,\,$ then it can be uniquely extended to the entire real line to also satisfy the recursion equation. Note that all of these continuous functions $\,f(x)\,$ agree at all integer values of $\,x.\,$ That is, $\,f(n) = F(n)\,$ for all integer $\,n.$

Somos
  • 37,457
  • 3
  • 35
  • 85
  • I'll be damned, you're completely right. I already got the answer to my actual question in the comments (it's "no"), but thanks for showing that the recursive Fibonacci definition can satisfy a lot more than just one equation over a complex domain. – Vlad Jan 19 '22 at 23:37
1

Welcome to MSE!

I think some of the confusion regarding the responses to this question come from the (admittedly subtle) distinction between a closed form solution to a recurrence and an extension of a recurrence (to all of $\mathbb{C}$, say).

If you're able to solve a recurrence, so that $T(n) = f(n)$ where $f$ is some "nice" function, then we get a canonical extension of $T$ to the whole of $\mathbb{C}$ (or whatever the domain of $f$ is) which is likely to be continuous (indeed, differentiable, smooth, analytic, etc.).

However, this is far from the only way to extend a recurrence to all of $\mathbb{C}$. As Somos points out, there are lots of functions $f$ so that $f(n) = T(n)$ on $\mathbb{Z}$. Indeed, as you can see in this answer, we can always find such an $f$. Though this is likely to be unsatisfying, since the $f$ we get seems to have nothing at all to do with our original recurrence! Moreover, the $f$ we get is likely to be difficult to compute with in practice.

So then, it seems like you're interested in solving recurrences (in the sense of finding a closed form), since this gives us a canonical means of extending the domain of $T$ which has the extra benefit of being "effective", in the sense that a good computer algebra system (like sage) will be able to actually compute with the resulting function.

The good news is that there's lots of literature on solving recurrences. See, for instance, the excellent books Generatingfunctionology (freely and legally available here) and Concrete Mathematics (freely and probably illegally available here).

The bad news is that solving recurrence relations is extremely difficult in general. Already the recurrence $T(n) = T(n-1)^2 + 1$ doesn't have a known closed form (and provably doesn't have a closed form for a certain formalization of that phrase. See here). Oftentimes it's a difficult problem to just obtain asymptotics for $T(n)$.

As an aside, recurrences are closely related to iterating polynomials. For instance, the recurrence relation above $T(n) = T(n-1)^2 + 1$ clearly satisfies $T(n) = \underbrace{p(p(p( \cdots (p}_{n \text{ times}}(T(0)) \cdots )))$, where $p(x) = x^2 + 1$, but at this point we should be quite worried! After all, iterating polynomials quickly gives rise to chaotic behavior. See the logistic map for a strikingly simple example. This gives some justification for why solving recurrences must be hard in general!


I hope this helps ^_^