Link to home
Start Free TrialLog in
Avatar of dante1st
dante1st

asked on

how to convert decimal values to radians

The ArcCos of radical[3]/2 is .5235987756, which is pi/6. But suppose I didn't know that. My question is how do I convert these kinds of decimal values to radians? If I could, I would like to know how to do it with: TI-83 Plus calculator, how to do it with Mathematica 4.2, and also by hand, if it's possible, thanks. (The problem that led me to ask this: ArcTan of 170/150radical[3])

I appreciate any help
Avatar of alexcvt
alexcvt

I would like to help, but I don't understand what you are asking.
Avatar of dante1st

ASKER

When I'm doing a problem in which I'm working with vectors, and I need to find the angle of something, eventually I'm going to come to a step when I set Tan[theta] equals Sin/Cos right? now, to find the angle theta, I would take the ArcTan of both sides, and that gives me the angle, but it will be in decimal form. I want to know how to convert that to radians (e.g, 3pi/4 or whatever).
A measure of an angle is not a simple decimal. ".5235987756" is NOT a measure of an angle

For instance : ".5235987756 rad" is such a measure, "12.5 deg" also is, and "99.05 grad" is too.

Are you looking for some algorythm that would do   .5235987756 --> pi/6   automatically ?

In the negative, you already have what you're looking for. You just need to make sure that the calculator you're using is in the correct mode. Even the windows calc applet has such a setting (in scientific mode).
ok, I if I were to divide 3.1415926/6, the answer is .5235987756. See, that's because the division was carried out. 3.1415926/6 is the same as pi/6. I don't want that to be divided, that's my point. I want it to be left in a non-simplified form (if that's what it's called).  Essentially I'm trying to get the fractional form of a decimal (fractional form with pi in it), because in visualizing a unit circle, I know *exactly* where pi/6 is. BUT, I have *no clue* where .5235987756 is, although they're equal in value. That's what I'm trying to get at. Ok look at this, if I were to type into my calculator: ArcCos radical[3]/2, it doesn't matter what mode my calc is in (Rad, Deg,), my calc always spits out ".5235987756." My problem is here. From this step on, *how do I figure out where on the unit circle this would be?* That question led me to my next approach, in thinking there was a way for the calc to represent that as a fraction with pi in it (represent .5235987756 as pi/6). Phew! sorry for the confusion, I didn't specify that to begin.

summary of problem: to know exactly where on a unit circle a decimal representation such as .5235987756 would belong. It's much easier for me to see that as pi/6, which is why I need a way to go from one to the other. Thanks
If you stare with some angle Q, you could visualize it as follows:

                               Q
----------------------------------------------------------  X  100 %
2 * 3.1415926535897932384626433832 . . .


This is the angular fractional percentage of the unit circle.
Here's some code that will give you the fraction closest to some decimal:



#include <stdio.h>
#include <math.h>

#define HiSearchLimit 100

int main( int argc, char * argv )
{
double err,  target, pi, miss;
int num, den, up,down;

pi     = 3.1415926;
target = 0.5235987756;
 
err = 99999999.9; up = 0; down = 0;

for( num = HiSearchLimit; num >= 1; num-- )
      for( den = HiSearchLimit; den >= 1; den-- ) {
        miss = fabs( (pi * ( (double) num / (double) den )) - target );
        if( miss <= err ) { err = miss; up = num; down = den; }
      }


if( down == 0 ) printf("No approx???\n");
else
                printf("closest approx is pi * %d / %d\n", up, down );
}

The true algorithmic approach though if you want a non-decimal fraction is (I will use your example):

Q = 0.5235987756

Qp = Q / pi = Q / 3.14159265358979323846264338327950288 . . .  = 0.16667 (I truncated to 5 decimal places)

    16667
= ----------
    100000

You would then prime-factoriize both numerator and denominator and cancel like factors.  You would then be left with a rational number which is a (in this case 5-decimal)
approximation to) pi-multiplier roughly equivalent to your original angle Q.

As you can see, however, the more decimal places you keep, the more factorization becomes computationally expensive.
The other problem is that if your truncated decimal digits themselves form a prime number, your approximation is no more helpful than the original decimal.
ASKER CERTIFIED SOLUTION
Avatar of BradleyEE
BradleyEE

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Usually you are not interested in the fractions of pi radians unless it is a simple fraction, which means you could have just a lookup table of just a few values,
i.e. pi, pi/2, pi/3, pi/4, pi/6, 2pi/3 and so on. (Mind the tolrance in the conversion). No use even bothering with trying to display 1365653/3233392 pi radians, the decimal number will probaby do the job if you cant find it in your table.

This is of course if your answer comes in the form .332323rad, in mathematica you could probably do symbolics all the way, and just avoid the last step where the output converts the answer to decimal. Mathematica of also easily also does decimal to fraction conversion like mrdtn mentioned above, but
be aware that fractions are NOT easily readable unless among the really easy ones, pi/2 etc.

Conclusion:
If the result should be read by humans, I'd go for the small table with fallback to decimals. If the result is to be used in further calculations, I'd go with either trying to persuade mathematica to do symbols all the way, or tell it to convert to fractions.
360 degrees = 2pi radians
just write a program that takes the decimal as an input, divides by pi, then use the (>Frac) command to output the fraction of pi. if you don't have enough decimals for the TI to convert it to a frac, it'll still display the fraction in decimal form, but the pi will have been divided out, so instead of .5235987756 you'd get .1666666667 which is easy to recognize as 1/6, just as .66666666667 is easily recognizable as 2/3.
Thanks for the help you guys. Brad, I can't believe I was so braindead to not see that. The answer is simple. To avoid getting decimal, just keep the TI in degree mode, and then you will have a degree answer. From there simply convert to radian, lol. Can't believe I overlooked that, thanks. Oh, there's some people here who didn't read my question carefully....
Maybe because your question was poorly worded?  :o
kkamke Did you think I was reffering to you? I didn't specify anyone, yet you responded. Admittedly, the first time I asked it, I didn't clarify all points. But after having the first few respondents answer, I realized that I was indeed too unspecific, so then I followed up my question with two additional clarifying posts, which I thought was clear enough. Stick to what you know best son
lol?