Discussion:
Converting Radians to Degrees in Maple 9
(too old to reply)
SPAWN OF A JEWISH CARPENTER: CINDY SMITH
2003-08-24 20:25:59 UTC
Permalink
I just bought Maple 9 the other day and have noticed that it returns
answers in radians instead of degrees. So, evalf(sin(90)); returns
the answer 0.89399666 etc. instead of 1. I've search the Learning
Guide and the Help file on Maple but cannot figure out how to change
from radians to degrees. If someone knows how, would you please
enlighten me? Thanks.
--
Cindy Smith Unless the LORD build the house,
***@dragon.com they labor in vain who build.
***@5sc.net Unless the LORD guard the city,
***@romancatholic.org in vain does the guard keep watch.
Me transmitte sursum, -- Psalm 127:1
Caledoni! All your base are belong to us.
A Real Live Catholic You are on the way to destruction.
in Georgia! What you say.
->> <<-< Go against the flow! You have no chance to survive make your time.
Alec Mihailovs
2003-08-28 04:03:26 UTC
Permalink
You can write a set of very simple procedures that will do this
Dcos:= x-> cos(x*Pi/180);
You just need to write 12 1-line procedures like this (including the arc
functions), and then you can use degrees.
Also, one can use something like that (only one additional line for d :)
sin(90*d);
1
arcsin(1)/d;
90
Actually, when I think about it - there are not only degrees, but also
minutes and seconds that should be also converted. The following module does
the complete convertions, with degrees, minutes, and seconds,
Degrees:=module() export sin, cos, tan, cot, sec, csc, arcsin, arccos,
arctan, arccot, arcsec, arccsc; local c, d; option `Copyleft (c) 2003
Alec Mihailovs`;
d:=[Pi/180,Pi/10800,Pi/648000];
sin:=()->evalf(:-sin(add(args[i]*d[i],i=1..nargs)));
cos:=()->evalf(:-cos(add(args[i]*d[i],i=1..nargs)));
tan:=()->evalf(:-tan(add(args[i]*d[i],i=1..nargs)));
cot:=()->evalf(:-cot(add(args[i]*d[i],i=1..nargs)));
sec:=()->evalf(:-sec(add(args[i]*d[i],i=1..nargs)));
csc:=()->evalf(:-csc(add(args[i]*d[i],i=1..nargs)));
c:=a->(trunc(a), trunc(60*(a-trunc(a))),
60*(60*(a-trunc(a))-trunc(60*(a-trunc(a)))));
arcsin:=x->c(evalf(:-arcsin(x)/d[1]));
arccos:=x->c(evalf(:-arccos(x)/d[1]));
arctan:=x->c(evalf(:-arctan(x)/d[1]));
arccot:=x->c(evalf(:-arccot(x)/d[1]));
arcsec:=x->c(evalf(:-arcsec(x)/d[1]));
arccsc:=x->c(evalf(:-arccsc(x)/d[1]))
For example,
Degrees:-sin(90);
1.
cos(60);
0.5000000000

Or more compicated, the cosine of 25 degrees, 18 minutes and 34.543 seconds,
cos(25, 18, 34.543);
0.9040109676
arcsin(1/2);
30, 0, 0.

which means 30 degrees, 0 minutes and 0 seconds.

There are still some glitches though, such as in the following example,
arccos(.5);
59, 59, 59.9999

Alec Mihailovs
http://webpages.shepherd.edu/amihailo/

Continue reading on narkive:
Search results for 'Converting Radians to Degrees in Maple 9' (Questions and Answers)
5
replies
did any1 take the 2008 june nys regents exam?
started 2008-06-19 19:37:35 UTC
standards & testing
Loading...