Compare commits

...

4 Commits
dev ... dev2

Author SHA1 Message Date
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
baiobelfer
1166790801 feat: add programming challenges with increasing difficulty for student assessment
Co-authored-by: aider (openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-09-02 14:53:34 +02:00
baiobelfer
658d49bd00 feat: add circle to linear function plot
Co-authored-by: aider (openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-09-02 14:51:38 +02:00
u2
6a86badaea rozw z1 2025-09-02 20:10:58 +08:00
3 changed files with 130 additions and 2 deletions

View File

@ -1,5 +1,68 @@
Napisz program w języku Python, który narysuje wykres funkcji liniowej y=x.
Programming Challenges - Increasing Difficulty
Author: AI
Task 1: Basic Plotting
Create a Python script that plots a simple quadratic function y = x^2 for x values from -5 to 5.
Requirements:
- Use NumPy to generate the x values (at least 100 points)
- Calculate corresponding y values
- Plot the function using Matplotlib
- Add appropriate labels and title
Task 2: Multiple Functions
Extend your script to plot two functions on the same graph:
- y1 = sin(x)
- y2 = cos(x)
Requirements:
- Plot both functions for x values from 0 to 4π
- Use different colors for each function
- Add a legend to distinguish the functions
- Include axis labels and a title
Task 3: Parametric Plotting
Create a script that plots a parametric curve (e.g., a spiral or Lissajous figure).
Requirements:
- Use parametric equations to generate x and y coordinates
- Plot the curve with appropriate styling
- Add labels, title, and grid
- Experiment with different parameter ranges
Task 4: Data Visualization
Create a script that visualizes a dataset (you can generate synthetic data or use built-in datasets).
Requirements:
- Create at least 2 different types of plots (e.g., line plot, scatter plot, bar chart)
- Include proper labels, titles, and legends
- Use color effectively to enhance understanding
- Add annotations or special markers for important data points
Task 5: Interactive Plotting
Create an interactive plot where users can modify parameters and see the results in real-time.
Requirements:
- Use matplotlib widgets or another interactive library
- Allow users to change at least 2 parameters of a function
- Update the plot dynamically as parameters change
- Include clear instructions for the user
Task 6: Advanced Visualization
Create a comprehensive visualization that combines multiple plot types in subplots.
Requirements:
- Create at least 3 subplots with different types of visualizations
- Share axes where appropriate
- Use consistent styling across all subplots
- Include a main title for the entire figure
- Save the figure to a file with high resolution
Task 7: Object-Oriented Plotting
Refactor one of your previous scripts to use object-oriented Matplotlib approach.
Requirements:
- Use Figure and Axes objects explicitly
- Create reusable plotting functions or classes
- Implement proper error handling
- Document your code with comments or docstrings
Task 8: Custom Visualization
Create a unique visualization of your choice that demonstrates advanced Matplotlib features.
Requirements:
- Use advanced features like custom colormaps, 3D plotting, or animations
- Include data analysis or transformation
- Make the visualization informative and visually appealing
- Provide a clear explanation of what the visualization shows

37
roz/1.py Normal file
View File

@ -0,0 +1,37 @@
import matplotlib.pyplot as plt
import numpy as np
# Zdefiniuj zakres wartości x
x = np.linspace(-10, 10, 400) # 400 punktów od -10 do 10
# Oblicz wartości y = x
y = x
# Narysuj wykres
plt.plot(x, y, label='y = x')
# Dodaj okrąg
theta = np.linspace(0, 2*np.pi, 400)
radius = 5
x_circle = radius * np.cos(theta)
y_circle = radius * np.sin(theta)
plt.plot(x_circle, y_circle, label=f'Okrąg o promieniu {radius}')
# Dodaj siatkę
plt.grid(True)
# Dodaj etykiety osi
plt.xlabel('x')
plt.ylabel('y')
# Dodaj tytuł
plt.title('Wykres funkcji liniowej y = x z okręgiem')
# Pokaż legendę
plt.legend()
# Ustaw skalę osi, żeby wyglądało proporcjonalnie
plt.axis('equal')
# Wyświetl wykres
plt.show()

28
rozw Normal file
View File

@ -0,0 +1,28 @@
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()