This is the beginning of the hard math analysis

In [1]:
a = 5
In [2]:
b = a + 1

Let's mix some variables!

In [3]:
a + b
Out[3]:
11
In [4]:
z = a + b
In [6]:
z * 3
Out[6]:
33
In [1]:
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
In [2]:
def fib_list(n: int) -> list[int]:
    fibs = [0, 1]
    for _ in range(2, n):
        fibs.append(fibs[-1] + fibs[-2])
    return fibs
In [3]:
def plot_fib(n: int) -> None:
    fibs = fib_list(n)
    df = pd.DataFrame({"n": list(range(1, n+1)), "fib": fibs})

    # Plot inline
    plt.figure(figsize=(10, 4))
    plt.xlabel("n (index)")
    plt.ylabel("Fib(n)")
    plt.plot(df["n"], df["fib"], marker="o")
    plt.xlabel("n (index)")
    plt.ylabel("Fib(n)")
    plt.title(f"First {n} Fibonacci numbers")
    plt.grid(True)
    ax = plt.gca()
    ax.xaxis.set_major_locator(MaxNLocator(integer=True))
    ax.yaxis.set_major_locator(MaxNLocator(integer=True))
    plt.tight_layout()
    plt.show()
In [4]:
n = 20
plot_fib(n)
No description has been provided for this image