[Tutor] Maths: getting degrees from radians (or am I wrong?)

Kent Johnson kent37 at tds.net
Wed Sep 21 00:30:11 CEST 2005


Bernard Lebel wrote:
> Hello,
> 
> I have this little math problem. I have this formula from wich I get a
> dot product between two vectors.
> 
> cos(ß) = A.B / |A|.|B| = -0.0634
> So this would give me radians, right?

No, it's the cosine of ß, which has no units (a cosine is a ratio of two lengths)

> 
> Then if I use
> 
> math.degrees( -0.0634 )
> 
> This gives me a value of -3.6325524211294193.
> 
> However I have a book in front of me who says I should get a value of
> 93.635 degrees. mmmmm
> 
> Btw, in the book, the equation is written
> 
> ß = cos-1(-0.0634) = 93.635, where -1 is actually an exponent. Maybe
> I'm just interpreting this wrong?

The -1 means inverse. You have cos(ß) = -0.0634 - you want to find the angle whose cosine is -0.0634, i.e. (inverse cosine)(-0.0634). Another name for cos-1 is arccosine. In Python it is math.acos():
 >>> import math
 >>> math.acos(-0.0634)
1.6342388771557625
 >>> math.degrees(_)
93.634990377223801

Kent
> 
> 
> 
> Thanks
> Bernard
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 



More information about the Tutor mailing list