flin/rozw
baiobelfer 731062d3c6 feat: add solution for task2 with sin and cos plot
Co-authored-by: aider (openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-09-02 14:55:03 +02:00

29 lines
543 B
Plaintext

import numpy as np
import matplotlib.pyplot as plt
# Generate x values from 0 to 4π
x = np.linspace(0, 4*np.pi, 1000)
# Calculate y values for both functions
y1 = np.sin(x)
y2 = np.cos(x)
# Create the plot
plt.figure(figsize=(10, 6))
plt.plot(x, y1, color='blue', label='sin(x)')
plt.plot(x, y2, color='red', label='cos(x)')
# Add labels and title
plt.xlabel('x')
plt.ylabel('y')
plt.title('Sine and Cosine Functions')
# Add legend
plt.legend()
# Add grid for better readability
plt.grid(True, alpha=0.3)
# Display the plot
plt.show()