如何在我使用Python(Sympy)具有0个值的所有点上绘制一条线?
我想知道我的价值为0的所有点。我希望它在我的情节上显示。在所有值中都有一个红线,以使其显然。我不知道该怎么做,也找不到与此类似的Syspy Libiraries。这是我的代码:
import inspect
from IPython.display import display, Math
from sympy import *
xi,eta,b,a = symbols("xi,eta,b,a")
Nq = Matrix([[1,xi,eta,xi**2,xi*eta,eta**2,xi**2*eta,xi*eta**2]])
AINV = Matrix([[1,1,1,1,-b,-a,-b,-a],
[0,0,0,0,0,2*a,0,-2*a],
[0,0,0,0,-2*b,0,2*b,0],
[0,0,0,0,0,a,0,a],
[1,-1,1,-1,0,0,0,0],
[0,0,0,0,b,0,b,0],
[-1,-1,1,1,2*b,0,-2*b,0],
[-1,1,1,-1,0,-2*a,0,2*a]])
N = Nq*AINV
N1 = combsimp(N[0])
N2 = combsimp(N[1])
N3 = combsimp(N[2])
N4 = combsimp(N[3])
N5 = combsimp(N[4])
N6 = combsimp(N[5])
N7 = combsimp(N[6])
N8 = combsimp(N[7])
NN = Matrix([[N1,N2,N3,N4,N5,N6,N7,N8]])
NN
%matplotlib notebook
Xi = Matrix([0,12,16,8,4,2,4,7])
Yi = Matrix([4,0,12,7,3,5,7,8])
J1 = diff(NN,xi)*Xi
J2 = diff(NN,xi)*Yi
J3 = diff(NN,eta)*Xi
J4 = diff(NN,eta)*Yi
J = Matrix([[J1,J2],[J3,J4]])
JDet = J.det()
JDetPLOT = JDet.subs(a,1).subs(b,1)
plotting.plot3d(JDetPLOT,(xi,-1,1),(eta,-1,1))
I want to know all the points where i have the value of 0. And i would like it to show on my plot. Have a redline in all the values to make it obviously. I have no idea on how to do it and i could not find any sympy libiraries that did something similarly to this. This is my code:
import inspect
from IPython.display import display, Math
from sympy import *
xi,eta,b,a = symbols("xi,eta,b,a")
Nq = Matrix([[1,xi,eta,xi**2,xi*eta,eta**2,xi**2*eta,xi*eta**2]])
AINV = Matrix([[1,1,1,1,-b,-a,-b,-a],
[0,0,0,0,0,2*a,0,-2*a],
[0,0,0,0,-2*b,0,2*b,0],
[0,0,0,0,0,a,0,a],
[1,-1,1,-1,0,0,0,0],
[0,0,0,0,b,0,b,0],
[-1,-1,1,1,2*b,0,-2*b,0],
[-1,1,1,-1,0,-2*a,0,2*a]])
N = Nq*AINV
N1 = combsimp(N[0])
N2 = combsimp(N[1])
N3 = combsimp(N[2])
N4 = combsimp(N[3])
N5 = combsimp(N[4])
N6 = combsimp(N[5])
N7 = combsimp(N[6])
N8 = combsimp(N[7])
NN = Matrix([[N1,N2,N3,N4,N5,N6,N7,N8]])
NN
%matplotlib notebook
Xi = Matrix([0,12,16,8,4,2,4,7])
Yi = Matrix([4,0,12,7,3,5,7,8])
J1 = diff(NN,xi)*Xi
J2 = diff(NN,xi)*Yi
J3 = diff(NN,eta)*Xi
J4 = diff(NN,eta)*Yi
J = Matrix([[J1,J2],[J3,J4]])
JDet = J.det()
JDetPLOT = JDet.subs(a,1).subs(b,1)
plotting.plot3d(JDetPLOT,(xi,-1,1),(eta,-1,1))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您可以访问matplotlib轴,然后创建一个3D轮廓图,例如:
请注意,我为轮廓设置了一条红线,但是这是(很可能)您将要看到的。 matplotlib 3D并不是那么好:|
You can access the matplotlib axes and later create a 3d contour plot, like this:
Note that I set a red line for contour, however this is (most likely) what you are going to see. Matplotlib 3D isn't really that great :|