我想在Sympy中找到矩阵的特征向量并编写以下程序,但它不起作用.另一方面,Sympy中的A.eigenvects()函数计算矩阵A的特征值和特征向量,我在这里使用了类似的东西但是当我想打印结果时,会显示一个空列表.你能指导我吗?
from sympy import *
H=Matrix([ [215.0 ,-104.1 ,5.1 ,-4.3 ,4.7 ,-15.1 ,-7.8],
[-104.1 , 220.0 ,32.6 , 7.1 ,5.4 , 8.3 ,0.8],
[ 5.1 , 32.6 , 0. , -46.8 , 1.0 , -8.1 , 5.1 ],
[ -4.3 , 7.1 ,-46.8 ,125.0 ,-70.7 ,-14.7 ,-61.5],
[ 4.7 , 5.4 , 1.0 ,-70.7 ,450.0 ,89.7 ,-2.5],
[-15.1 , 8.3 ,-8.1 ,-14.7 ,89.7 ,330.0 ,32.7],
[-7.8 ,0.8 ,5.1 ,-61.5 ,-2.5 ,32.7 ,280.0]])
zz=H.eigenvects()
pprint(zz)
Run Code Online (Sandbox Code Playgroud) 我想使用与在 Matplotlib中绘制以平面为中心的实心圆柱体中使用的方法完全相同的方法绘制截锥体 ;当每个底面中心的两点和半径已知时,它绘制一个圆柱体。另一方面,当知道其底中心的两点坐标和每个底的半径时,我想绘制一个截锥。似乎我应该更改以下绘制圆柱体的程序中函数的倒数第二行,但我无法尽全力做到这一点。
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from scipy.linalg import norm
import pylab as pllt
fig = pllt.figure()
ax = fig.add_subplot(1,1,1, projection='3d')
#ax = pllt.subplot2grid((2,2), (0,0), rowspan=2, projection='3d')
#axis and radius
def cylinder(p0,p1,R,ccc):
#vector in direction of axis
v = p1 - p0
#find magnitude of vector
mag = norm(v)
#unit vector in direction of axis
v = v / mag
#make some vector not in the same direction as …Run Code Online (Sandbox Code Playgroud)