TypeError: No loop matching the specified signature and casting was found for ufunc solve1

直接上代码:

import sympy as sp

import numpy as np

ss=sp.Symbol('ss')

tt=sp.Symbol('tt')    

f2=[]

for i in range(n):

       #下面这个是从0到1的二重积分

        f2.append(sp.integrate((5*sp.sqrt(tt)-sp.integrate(sp.exp(ss*tt)*sp.sqrt(ss),(ss,0,1))*tt**i),(tt,0,1)).evalf())

然后用f2求解x的时候报错!!!

x=np.linalg.solve(A,f2) #其中A为系数矩阵

解决方法:对f2的数据类型进行转换:

f2=np.array(f2,dtype='float')

然后就可以正常了


猜你喜欢

转载自blog.csdn.net/wushaowu2014/article/details/79864672
今日推荐