ufunc“multiply”不包含签名匹配类型为dtype('<U32')dtype('<U32')dtype('<U32')的循环

2024-04-26 09:31:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着写这个简单的脚本,但由于某种原因,我正在与数学乘法运算斗争。我得到的错误是

ufunc 'multiply' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')

我是第一次使用PyCharm作为编辑,我从来没有与木星有过这个问题。

这是我的密码

import numpy as np


polar_surfacetension = input('Enter the polar component of the surface tension in mN/m (46.4 for water): ')
polar_dispersive = input('Enter the dispersive component of the surface tension in mN/m (26.4 for water): ')
polar_angle = list()
print("Polar Solvent measurements")
num = input("Enter numbers of measurements performed :")
print('Enter angles values in degrees: ')
for i in range(int(num)):
    n = input("Value :")
    polar_angle.append(float(n))

non_polar_surfacetension = input('Enter the  non polar component of the surface tension in mN/m (50 for \
diiodomethane): ')

print("Non Polar Solvent measurements")
non_polar_angle = list()
num_2 = input("Enter numbers of measurements performed :")
print('Enter angles values in degrees: ')
for i in range(int(num_2)):
    n = input("Value :")
    non_polar_angle.append(float(n))

solid_dispersive = (((np.cos([non_polar_angle])+1)**2)*non_polar_surfacetension)/4

print (solid_dispersive)

谢谢你!


Tags: oftheinforinputnumprintenter