Jump to content

Recommended Posts

Posted

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?

Posted
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.

Posted
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.

Posted

Math answer, not Lisp.

 

degrees = 180 x rads / pi.

 

or

 

(/ (* a 180.0) pi)

Posted
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

Posted

I haven't come across that before, can you show me your example.

Posted
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).

Posted
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

Posted
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!

Posted

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.

Posted
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

Posted

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. :)

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...