Having issues with getting this working. My plan for it is to be used to calculate reference angles for an inputted angle. Any help would be appreciated. One of the errors I've noticed is when I try to type, for example: -500. It spits out 220 (which is correct due to adding 720 to -500 to keep it within the range of 0-360). But the reference angle that was given is 90.

Code:
``` ClrHome Input "ANGLE: ",A A→B ClrHome While B<0: B+360→B End If B>360: remainder(B,360)→B Output(1,1,"ANGLE: ") Output(1,8,A) Output(2,1,"UNWOUND ANGLE: ") Output(2,16,B) If B=0 or B=180: Output(3,1,"REF. ANG. IS: 0") Else:If B=90 or B=270 Then Output(3,1,"REF. ANG. IS: 90") Else:If B>0 and B<90 Then Output(3,1,"REF. ANG. IS: ") Output(3,15,B) Else:If B>90 and B<180 Then Output(3,1,"REF. ANG. IS: ") (180-B)→B Output(3,15,B) Else:If B>180 and B<270 Then Output(3,1,"REF. ANG. IS: ") (B-180)→B Output(3,15,B) Else:If B>270 and B<360 Then Output(3,1,"REF. ANG. IS: ") (360-B)→B Output(3,15,B) ```
portal3

I didnt try to figure out why your code isnt working, but heres a smaller version that I think works. This is written in Lua, so you might have to convert it a little. The % is the remainder command and the math.abs is the abs command. Try different angles and see if it might work for you.

Code:
```     angle=-30         r=angle%180     e=math.abs(180-r)     f=math.abs(r)     ref=math.min(e,f)     print("angle ",angle)            print("unwound",angle%360)     print("reference ",ref) ```
Alright, thanks! I will try it out and see if I can convert it!
dave1707 wrote:
portal3

I didnt try to figure out why your code isnt working, but heres a smaller version that I think works. This is written in Lua, so you might have to convert it a little. The % is the remainder command and the math.abs is the abs command. Try different angles and see if it might work for you.

Code:
```     angle=-30         r=angle%180     e=math.abs(180-r)     f=math.abs(r)     ref=math.min(e,f)     print("angle ",angle)            print("unwound",angle%360)     print("reference ",ref) ```
dave1707 wrote:
portal3

I didnt try to figure out why your code isnt working, but heres a smaller version that I think works. This is written in Lua, so you might have to convert it a little. The % is the remainder command and the math.abs is the abs command. Try different angles and see if it might work for you.

Code:
```     angle=-30         r=angle%180     e=math.abs(180-r)     f=math.abs(r)     ref=math.min(e,f)     print("angle ",angle)            print("unwound",angle%360)     print("reference ",ref) ```

Got a working solution! Code came out to be:

Code:
``` Input "ANGLE: ",A ClrHome A→B Repeat B≥0 B+360→B End If B>360 remainder(B,360)→B abs(180-B)→C abs(B)→D min(C,D)→R ClrHome Output(1,1,"ANGLE: ") Output(1,8,A) Output(2,1."UNWOUND: ") Output(2,10,B) Output(3,1,"REF. ANG.: ") Output(3,12,R)```
I modified the code a little. The graph limits (Window) should be -10,10 for both the X and Y min, max limits. Press ENTER to enter different angle values. This was written for my TI84+CE.

Code:
``` Lbl Z ClrHome Input "ANGLE  ",A ClrDraw cos(A)*20→B sin(A)*20→C Line(-10,0,10,0,RED) Line(0,0,B,C,BLUE) remainder(abs(A),360)→U remainder(abs(A),180)→R abs(180-R)→E min(E,R)→R if A<0:360-U→U min(R,U)→R TextColor(NAVY) Text(0,30,"ANG= ",A,"  UNW= ",U,"  REF= ",R) Text(150,85,"PRESS  ENTER") Pause Goto Z ```
dave1707 wrote:
I modified the code a little. The graph limits (Window) should be -10,10 for both the X and Y min, max limits. Press ENTER to enter different angle values. This was written for my TI84+CE.

Code:
``` Lbl Z ClrHome Input "ANGLE  ",A ClrDraw cos(A)*20→B sin(A)*20→C Line(-10,0,10,0,RED) Line(0,0,B,C,BLUE) remainder(abs(A),360)→U remainder(abs(A),180)→R abs(180-R)→E min(E,R)→R if A<0:360-U→U min(R,U)→R TextColor(NAVY) Text(0,30,"ANG= ",A,"  UNW= ",U,"  REF= ",R) Text(150,85,"PRESS  ENTER") Pause Goto Z ```

Adding a ZStandard as the first line can easily set the graph bounds.

Is the graph meant to show the reference line? Because if I were to put -5, I get something between 0 and 90° when the reference line should be on the 4th quadrant
If I key a -5 angle, the blue line is just below the red line in the 4th quadrant. I double checked the code I have on my TI84+CE and what I posted here and its the same. I had to hand key the code because I didnt hook the calculator to a PC. Too much trouble for a small program. Check the code and let me know if you still have a problem. Are the values that print at the top correct. It should be print ANG= -5 UNW= 355 REF= 5.
dave1707 wrote:
If I key a -5 angle, the blue line is just below the red line in the 4th quadrant. I double checked the code I have on my TI84+CE and what I posted here and its the same. I had to hand key the code because I didnt hook the calculator to a PC. Too much trouble for a small program. Check the code and let me know if you still have a problem. Are the values that print at the top correct. It should be print ANG= -5 UNW= 355 REF= 5.

So this is what I have with the code:

Code:
``` Lbl Z ClrHome Input "ANGLE: ",A ClrDraw -cos(A)*20→B sin(A)*20→C Line(­10,0,10,0,RED) Line(0,0,B,C,BLUE) remainder(abs(A),360)→U remainder(abs(A),180)→R abs(180-R)→E min(E,R)→R If A<0:360-U→U min(R,U)→R TextColor(NAVY) Text(0,30,"ANG: ",A,"  UNW: ",U,"  REF: ",R) Text(150,85,"PRESS  ENTER") Pause Goto Z ```

Tried to swap the spots for B and C as well. I did notice that if I make B's declaration as -cos(a)*20 rather than cos(a)*20 I have the line looking correct.

Edit again: nevermind, that was more of a 1-case thing. I'll see whats I get if I keep B's declaration positive.
My code is setup to use degrees not radians. Check the settings (mode) and see if you have radians or degrees set.
dave1707 wrote:
My code is setup to use degrees not radians. Check the settings (mode) and see if you have radians or degrees set.

Fixed. It looks correct, thanks! Is there any possible way to make it so we can view the reference angle as well, rather than just the angle by itself?
I never heard of reference angle before I saw this post. From what I understood reading about the reference angle, the reference angle is the angle between the blue line and the red line and not an actual line but just a value. So Im not sure what you want to view. Or do you always want to see another angle (line) drawn in the first quadrant.
dave1707 wrote:
I never heard of reference angle before I saw this post. From what I understood reading about the reference angle, the reference angle is the angle between the blue line and the red line and not an actual line but just a value. So Im not sure what you want to view. Or do you always want to see another angle (line) drawn in the first quadrant.

Going for a line in the first quadrant to show that that line is the reference angle.
This looks like it works:

Code:
``` Degree ­10→Xmin 10→Xmax Xmin→Ymin Xmax→Ymax ClrHome Input "ANGLE: ",A ClrDraw cos(A)*20→B sin(A)*20→C Line(­10,0,10,0,RED) Line(0,0,B,C,BLUE) remainder(abs(A),360)→U remainder(abs(A),180)→R abs(180-R)→E min(E,R)→R If A<0:360-U→U min(R,U)→R cos(R)*20→X sin(R)*20→Y Line(0,0,X,Y,GREEN) TextColor(NAVY) Text(0,30,"ANG: ",A,"  UNW: ",U,"  REF: ",R) Pause```

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are GMT - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum