Zins


import numpy as np
import matplotlib.pyplot as plt

# Parameter
x0 = 100000          # Anfangskapital
p = 0.07         # Zinssatz
t_end = 30           # Jahre

x = np.zeros(t_end+1)
x[0] = x0
for i in range(0, t_end):
    x[i+1] = (1 + p)  * x[i]

# Plot
plt.figure(figsize=(8, 5))
plt.plot(range(t_end+1), x, marker='o')
plt.title("Zinseszins-Kurve (x=100000, p=0.07, t=30)")
plt.xlabel("Jahre")
plt.ylabel("Vermoegen")
plt.grid(True)
plt.show()