ax.set_aspect('equal', adjustable='datalim') ax.plot() plt.xlabel('x') plt.ylabel('y') plt.title('Circle with center at (0,0) and radius 3') plt.grid(True) plt.show()
2. Окружность с центром в (1, -2) и радиусом 2 ```python import matplotlib.pyplot as plt import numpy as np circle2 = plt.Circle((1, -2), 2, color='b', fill=False) fig, ax = plt.subplots() ax.add_artist(circle2) ax.set_aspect('equal', adjustable='datalim') ax.plot() plt.xlabel('x') plt.ylabel('y') plt.title('Circle with center at (1,-2) and radius 2') plt.grid(True) plt.show()
Первая окружность имеет уравнение x^2 + y^2 = 9, что соответствует окружности с центром в точке (0, 0) и радиусом 3.
Вторая окружность имеет уравнение (x-1)^2 + (y+2)^2 = 4, что соответствует окружности с центром в точке (1, -2) и радиусом 2.
Графики окружностей:
Окружность с центром в (0, 0) и радиусом 3import matplotlib.pyplot as plt
import numpy as np
circle1 = plt.Circle((0, 0), 3, color='r', fill=False)
fig, ax = plt.subplots()
ax.add_artist(circle1)
ax.set_aspect('equal', adjustable='datalim')
2. Окружность с центром в (1, -2) и радиусом 2ax.plot()
plt.xlabel('x')
plt.ylabel('y')
plt.title('Circle with center at (0,0) and radius 3')
plt.grid(True)
plt.show()
```python
import matplotlib.pyplot as plt
import numpy as np
circle2 = plt.Circle((1, -2), 2, color='b', fill=False)
fig, ax = plt.subplots()
ax.add_artist(circle2)
ax.set_aspect('equal', adjustable='datalim')
ax.plot()
plt.xlabel('x')
plt.ylabel('y')
plt.title('Circle with center at (1,-2) and radius 2')
plt.grid(True)
plt.show()