The Buzzard Posted December 15, 2009 Posted December 15, 2009 Hi everyone, I am trying to find the cosine of an angle expressed in degrees. (cos ang) only provides this in radians. How would one go about converting this to degrees or is there another way? Quote
iskalipsi Posted December 15, 2009 Posted December 15, 2009 Hi everyone, I am trying to find the cosine of an angle expressed in degrees. (cos ang) only provides this in radians. How would one go about converting this to degrees or is there another way? Go to Dimension Style Manager, then you can change the units of angular dimensions in the Primary Units tab. Quote
The Buzzard Posted December 15, 2009 Author Posted December 15, 2009 Go to Dimension Style Manager, then you can change the units of angular dimensions in the Primary Units tab. Thanks for the fast reply iskalipsi, This is for a program. That will not help me , But thanks anyway. Quote
PS_Port Posted December 15, 2009 Posted December 15, 2009 Math answer, not Lisp. degrees = 180 x rads / pi. or (/ (* a 180.0) pi) Quote
The Buzzard Posted December 15, 2009 Author Posted December 15, 2009 Math answer, not Lisp. degrees = 180 x rads / pi. I already tried that, It does not work. I need to fine the cosine of the angle in degrees. (cos ang) expresses it in radians. The conversion formula for radians to degrees will not provide the cosine in degrees. Thank you anyway Quote
PS_Port Posted December 15, 2009 Posted December 15, 2009 I haven't come across that before, can you show me your example. Quote
The Buzzard Posted December 15, 2009 Author Posted December 15, 2009 I haven't come across that before, can you show me your example. Example: (cos 45) returns 0.525322 on the command prompt. On a scientific calculator this is the same expressed in radians. Also on the calculator you can change to degrees which will return 0.707106. This is the value I am looking for, But cannot seem to solve since all I have to work with is (cos 45). Quote
PS_Port Posted December 15, 2009 Posted December 15, 2009 Example: (cos 45) returns 0.525322 on the command prompt.On a scientific calculator this is the same expressed in radians. Also on the calculator you can change to degrees which will return 0.707106. This is the value I am looking for, But cannot seem to solve since all I have to work with is (cos 45). Ahh now I see, I assume your '45' is in degrees, change this to radians before the cos function. so, (45 x pi) / 180 = 0.78539 .... now 45 in expressed in radians then, (cos 0.78539) = 0.707106 Quote
The Buzzard Posted December 15, 2009 Author Posted December 15, 2009 Ahh now I see, I assume your '45' is in degrees, change this to radians before the cos function. so, (45 x pi) / 180 = 0.78539 .... now 45 in expressed in radians then, (cos 0.78539) = 0.707106 Thanks PS_Port! On the money! Quote
muthu123 Posted December 15, 2009 Posted December 15, 2009 Please define functions to convert degrees to radians and radians to degrees as given below. Whenever you need to convert, you can call that function and use it. (defun dtr (X) (* X (/ pi 180.0))) (Defun rtd (X) (* X (/ 180.0 pi))). In your case, you have to call (cos (dtr 45)). same way you can use it such like (sin (dtr 60)), (atan (dtr 30)) and so on. I hope you are new to the lisp. so better you can refer the websit afralisp.net. Quote
The Buzzard Posted December 15, 2009 Author Posted December 15, 2009 Please define functions to convert degrees to radians and radians to degrees as given below. Whenever you need to convert, you can call that function and use it.(defun dtr (X) (* X (/ pi 180.0))) (Defun rtd (X) (* X (/ 180.0 pi))). In your case, you have to call (cos (dtr 45)). same way you can use it such like (sin (dtr 60)), (atan (dtr 30)) and so on. I hope you are new to the lisp. so better you can refer the websit afralisp.net. I appreciate your responce muthu, But I am already familar with those functions. I tried to write everything into one statement, But that did not work. I now have it in two statements as PS_Port suggested and it works fine. I guess I am just a bit tired. (setq ARAD (TRAN_DTR TANG)) (setq SIDE-c (/ SIDE-a (cos ARAD))) This works well for what I am doing. Thanks anyway, The Buzzard Quote
Lee Mac Posted December 15, 2009 Posted December 15, 2009 In one statement: (cos (* pi (/ 45. 180.))) Lee Quote
PS_Port Posted December 15, 2009 Posted December 15, 2009 Buzzard, Glad it worked for you mate. I'm not much of a lisper, just love math questions. It also gives the almighty math lisper god, Lee, a chance for a giggle. Quote
The Buzzard Posted December 15, 2009 Author Posted December 15, 2009 In one statement: (cos (* pi (/ 45. 180.))) Lee Lee, The method I used worked OK, But I shortened it to one statement keeping the DTR & RTD functions as local functions all the same. Thanks Ps_Port Thanks again, Its been a while for me since I last used trig. I got thru this with a little pain, But its done now. I will look over the rest to see how I can reduce the long-winded coding. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.