#! ./bin/python # encoding:utf-8 import matplotlib.pyplot as plt import numpy as np def plot_normal_parabel(): # Erzeuge Datenpunkte für x-Werte von -10 bis 10 x = np.linspace(-3, 3, 100) # Berechne die y-Werte für die Normalparabel y = x**2 # Erstelle das Diagramm plt.plot(x, y, label='Normalparabel: $y=x^2$') # Beschriftungen und Titel hinzufügen plt.xlabel('x-Achse') plt.ylabel('y-Achse') plt.title('Normalparabel') # Legende hinzufügen plt.legend() def plot_sinus_function(): # Erzeuge Datenpunkte für x-Werte von -2π bis 2π x = np.linspace(-2 * np.pi, 2 * np.pi, 100) # Berechne die y-Werte für die Sinusfunktion y = np.sin(x) # Erstelle das Diagramm für die Sinusfunktion plt.plot(x, y, label='Sinusfunktion: $y = \sin(x)$', color='blue') # Legende hinzufügen plt.legend() # Funktion aufrufen, um die Normalparabel zu zeichnen plot_normal_parabel() plot_sinus_function() # Diagramm anzeigen plt.grid(True) plt.show()