问题
I'm trying to write this simple script but for some reason i'm struggling with the mathematical multiply operation. The error that I am getting is
ufunc 'multiply' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')
I am using PyCharm for the first time as editor and I've never had this problem with jupiter.
This is my code
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)
Thank you!
来源:https://stackoverflow.com/questions/37751405/ufunc-multiply-did-not-contain-a-loop-with-signature-matching-types-dtypeu3