如何使用python sumpy plot隐式在同一图中绘制不同的隐式方程

我想使用 python sympy plot_implicit 在同一个图中绘制不同的方程。


下面是我的示例代码,但这不能正常工作。现在隐函数只是圆,但我想在不久的将来处理更复杂的方程。


此外,我也想在同一个图中绘制坐标点(在示例代码中作为“点”给出)。


谁能解这个方程?


import math

import numpy as np

import matplotlib.pyplot as plt

from sympy import *

from sympy.plotting import plot

from sympy.plotting import plot_implicit


points = np.array([[10,20], [20, 75], [45, 15], [70, 53], [90, 30]])

weights = np.array([5, 5.1, 5.2, 4.9, 4.8])


x, y = symbols("x y")


 for i in range(len(points)):

  G = (x-points[i][0])**2 + (y-points[i][1])**2 - weights[i]**2   

  p2 = plot_implicit(G, (x,-50,100), (y,-50,100), show=False, line_color='r')

  p2.extend(p2)


p2.show()


慕的地8271018
浏览 228回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python