0
import matplotlib.pyplot as plt import numpy as np x=np.linspace(-5,5,100) plt.plot(x,np.sin(x)) plt.xlabel("axe des absesse")
He guys . Please where I can execute like this cods it's about graphs and the numpy library
4 ответов
+ 1
In ms visual studio code.
https://code.visualstudio.com/Download
+ 1
Thanks
+ 1
I think this can also run on sololearn.
You can also try online platforms like:
- kaggle
- Google colab notebooks
0
import numpy as np
import matplotlib.pyplot as plt
# Values for x1 (chairs)
x1 = np.linspace(0, 100, 200)
# Wood constraint: 5x1 + 10x2 <= 500
x2_wood = (500 - 5*x1) / 10
# Metal constraint: 2x1 + 5x2 <= 300
x2_metal = (300 - 2*x1) / 5
# Plot the constraints
plt.figure(figsize=(8, 6))
plt.plot(x1, x2_wood, label="Wood constraint (5x1 + 10x2 ≤ 500)", color="blue")
plt.plot(x1, x2_metal, label="Metal constraint (2x1 + 5x2 ≤ 300)", color="red")
# Fill feasible region (the region where both constraints are satisfied)
plt.fill_between(x1, np.minimum(x2_wood, x2_metal), color="grey", alpha=0.3)
# Labels and title
plt.xlim(0, 100)
plt.ylim(0, 60)
plt.xlabel("Chairs (x1)")
plt.ylabel("Tables (x2)")
plt.title("Feasible Region for Furniture Production")
# Highlight the intersection of the two lines
plt.legend()
plt.grid(True)
plt.show()