forsaken_pariah

May 11th, 2007, 01:45 AM

Hi all....

I've been trying to write a Python script to solve triangles given various types of information but I'm having a bit of trouble with math.asin()... The section that ails me at present looks like this:

. . .

A = math.radians(A)

sinB = (b*math.sin(A))/a

B = math.asin(sinB) #<---This is the part that screws me over.

return B

I can print B and it works just fine but the math.asin(sinB) part gives me a 'math domain error' and I have no idea why and there is a surprisingly small amount of documentation on the internet for this function. This is the exact error I'm getting:

Traceback (most recent call last):

File "./trisol.py", line 71, in <module>

print parseArgs(sys.argv)

File "./trisol.py", line 17, in parseArgs

return ssa(argv)

File "./trisol.py", line 60, in ssa

B = math.asin(sinB)

ValueError: math domain error

Any help would be greatly appreciated.

I've been trying to write a Python script to solve triangles given various types of information but I'm having a bit of trouble with math.asin()... The section that ails me at present looks like this:

. . .

A = math.radians(A)

sinB = (b*math.sin(A))/a

B = math.asin(sinB) #<---This is the part that screws me over.

return B

I can print B and it works just fine but the math.asin(sinB) part gives me a 'math domain error' and I have no idea why and there is a surprisingly small amount of documentation on the internet for this function. This is the exact error I'm getting:

Traceback (most recent call last):

File "./trisol.py", line 71, in <module>

print parseArgs(sys.argv)

File "./trisol.py", line 17, in parseArgs

return ssa(argv)

File "./trisol.py", line 60, in ssa

B = math.asin(sinB)

ValueError: math domain error

Any help would be greatly appreciated.