Files
physics/course2/sem3/labs/lab3.01/scripts/2.py
2025-10-13 21:13:00 +03:00

114 lines
2.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import matplotlib.pyplot as plt
import numpy as np
def main() -> None:
plt.figure(figsize=(8.27, 11.69))
plt.xlim(0, 30)
plt.ylim(0, 20)
plt.gca().set_aspect("equal", adjustable="box")
plt.grid(True, linewidth=0.3)
plt.xticks(range(0, 31, 2))
plt.yticks(range(0, 21, 2))
points = [
# phi = 2.4
(2.0, 2, "2.4"),
(2.1, 4, "2.4"),
(2.6, 6, "2.4"),
(2.8, 8, "2.4"),
(3.0, 10, "2.4"),
(2.8, 12, "2.4"),
(3.1, 14, "2.4"),
(2.7, 16, "2.4"),
(2.8, 18, "2.4"),
# phi = 3.4
(4.1, 2, "3.4"),
(4.0, 4, "3.4"),
(4.1, 6, "3.4"),
(4.0, 8, "3.4"),
(4.2, 10, "3.4"),
(4.2, 12, "3.4"),
(4.6, 14, "3.4"),
(4.5, 16, "3.4"),
(4.8, 18, "3.4"),
# phi = 4.4
(6.1, 2, "4.4"),
(5.9, 4, "4.4"),
(5.9, 6, "4.4"),
(5.5, 8, "4.4"),
(5.8, 10, "4.4"),
(5.7, 12, "4.4"),
(6.3, 14, "4.4"),
(7.0, 16, "4.4"),
(7.5, 18, "4.4"),
# phi = 5.4
(8.4, 2, "5.4"),
(7.8, 4, "5.4"),
(7.4, 6, "5.4"),
(7.2, 8, "5.4"),
(7.2, 10, "5.4"),
(7.7, 12, "5.4"),
(8.2, 14, "5.4"),
(9.8, 18, "5.4"),
# phi = 6.4
(11.2, 2, "6.4"),
(9.0, 6, "6.4"),
(8.8, 10, "6.4"),
(11.0, 14, "6.4"),
(12.3, 18, "6.4"),
# phi = 7.4
(16.0, 2, "7.4"),
(15.5, 18, "7.4"),
# phi = 8.4
(19.8, 2, "8.4"),
(20.3, 4, "8.4"),
(21.3, 6, "8.4"),
(21.7, 8, "8.4"),
(21.8, 10, "8.4"),
(21.3, 12, "8.4"),
(20.7, 14, "8.4"),
(19.7, 16, "8.4"),
(18.0, 18, "8.4"),
# phi = 9.4
(22.2, 2, "9.4"),
(22.8, 6, "9.4"),
(22.9, 10, "9.4"),
(22.5, 14, "9.4"),
(21.7, 18, "9.4"),
# phi = 10.4
(24.5, 2, "10.4"),
(24.4, 6, "10.4"),
(24.6, 10, "10.4"),
(24.2, 14, "10.4"),
(23.9, 18, "10.4"),
# phi = 11.4
(26.7, 2, "11.4"),
(26.2, 6, "11.4"),
(26.2, 10, "11.4"),
(26.0, 14, "11.4"),
(26.1, 18, "11.4"),
]
for x, y, label in points:
plt.scatter(x, y, color="red", s=10)
plt.text(x + 0.3, y + 0.3, label, fontsize=9)
theta = np.linspace(0, 2 * np.pi, 200)
cx, cy = 15, 9
for r in [5, 6]:
x = cx + r * np.cos(theta)
y = cy + r * np.sin(theta)
plt.plot(x, y, color="blue", linewidth=1)
plt.xlabel("X (см)")
plt.ylabel("Y (см)")
plt.title("Эквипотенциальные точки с кольцом")
plt.tight_layout()
plt.savefig("points.png", dpi=300)
if __name__ == "__main__":
main()