当我尝试在mpmath函数中使用numpy数组时收到错误消息,此示例在到达该行时失败:C = (f*L/D) + 2*mp.log(P1/P2)其中P1是一个数组。与错误:cannot create mpf from array([**P1_array**])我知道这个和这个步骤是相关的。但是我无法使我的代码正常工作。有人可以帮我纠正这个错误吗?import numpy as npimport mpmath as mpmp.mp.dps = 20# State equation --> pV = nZRTP1 = np.linspace(101325,10*101325,100)P2 = 101325T = 300D = 0.0095A = mp.power(D,2)*mp.pi/4L = 300R = 8.31446f = 0.05Z1 = 0.9992Z2 = 0.9999Zm = 0.5*(Z1+Z2)C = (f*L/D) + 2*mp.log(P1/P2)w2 = (mp.power(P1,2)-mp.power(P2,2))*mp.power(A,2)/(Zm*R*T*C)w = mp.power(w2,0.5)
添加回答
举报
0/150
提交
取消