【发布时间】:2019-11-24 11:27:58
【问题描述】:
我绘制了一组圆如下:
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure(1, figsize=(10,10))
numbers = [2,4,6]
for i in range(1,len(numbers)+1):
for n in numbers:
for j in range(1,4):
x = np.linspace(-20, 25, 100)
y = np.linspace(-20, 20, 100)
X, Y = np.meshgrid(x,y)
F = (X-i)**2 + Y**2 - (numbers[i-1]*j)**2
ax = plt.gca()
ax.set_aspect(1)
plt.contour(X,Y,F,[0])
plt.grid(linestyle='--')
plt.show()
我收到:
如何找到圆之间的所有交点?
【问题讨论】:
-
每个圈子得到 3 次,因为从未使用过
for n in numbers:的n。可能你会想要for i, n in enumerate(numbers)和F = (X-i-1)**2 + Y**2 - (n*j)**2`
标签: python python-3.x numpy matplotlib