Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi guys, i'm beginner of python, i trying use math.sqrt() to count distance.

print math.sqrt(float(data[0][0]) - float(k_cluster[0][0]**2) + float(data[0][1]) - float(k_cluster[0][1]**2)))

for example:

data[0] = 12.1
data[0][0] = 15.125

data[0][1] = 13.214

k_cluster[0][0] = 5.34
k_cluster[0][1] = 6.78

when i use code above it tell me math domain error, but if without math.sqrt() it work normally
do you know what the problem??
Posted
Updated 17-Mar-13 17:30pm
v2

1 solution

Check the placement of your parenthesis.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900