Lesson 4 of 15

Cauchy Sequences

Cauchy Sequences

A Cauchy sequence is one where the terms get arbitrarily close to each other, without needing to know the limit in advance.

Definition

A sequence ((a_n)) is Cauchy if for every (\varepsilon > 0), there exists (N) such that for all (m, n > N):

aman<ε|a_m - a_n| < \varepsilon

Key Theorem

In (\mathbb{R}), a sequence is Cauchy if and only if it converges. This is the completeness of the real numbers.

Why Cauchy Matters

The Cauchy criterion lets us prove convergence without knowing the limit. This is crucial when the limit is hard to compute directly.

Example

For (a_n = 1/n), given (\varepsilon > 0) and (m, n > N = \lceil 2/\varepsilon \rceil):

1/m1/n1/m+1/n<ε|1/m - 1/n| \le 1/m + 1/n < \varepsilon

Numerical Check

We can check the Cauchy condition for a finite range:

def is_cauchy(f, epsilon, N, check=50):
    for m in range(N+1, N+1+check):
        for n in range(N+1, N+1+check):
            if abs(f(m) - f(n)) >= epsilon:
                return False
    return True

Your Task

Implement is_cauchy(f, epsilon, N) that checks whether (|f(m) - f(n)| < \varepsilon) for all (m, n) in the range ([N+1, N+50]).

Also implement find_cauchy_N(f, epsilon) that finds the smallest (N) (starting from 1) such that is_cauchy(f, epsilon, N) returns True.

Pyodide loading...
Loading...
Click "Run" to execute your code.