def _gauss_from_coefficients_mpmath(alpha, beta, decimal_places):
mp.dps = decimal_places
# Create vector cut of the first value of beta
n = len(alpha)
b = mp.zeros(n, 1)
for i in range(n-1):
b[i] = mp.sqrt(beta[i+1])
z = mp.zeros(1, n)
z[0, 0] = 1
d = mp.matrix(alpha)
tridiag_eigen(mp, d, b, z)
# nx1 matrix -> list of sympy floats
x = numpy.array([sympy.Float(xx) for xx in d])
w = numpy.array([beta[0] * mp.power(ww, 2) for ww in z])
return x, w
评论列表
文章目录