Would using the Text( command be good for displaying values of trig functions be a good alternative to using tables? I’m planning to do 30°/45° angle increments, sort of how I made the unit circle program. I’d have the angles as row labels and the trig functions listed out as column labels.

It’d be like: cos | sin | tan | sec | csc | cot

30°
45°
60°
90°
120°
135°
150°

180°
210°
225°
240°
270°
300°
315°
330°
Then, I’d have all the intersections list the values of each angle. The line break represents a ClrDraw command being run.
Do something like this:


Code:

Menu("Trig Identity","sin",A,"cos",B,"tan",C,"cot",D,"sec",E,"csc",F)
Lbl A
"sin(X->Y1
Goto 0

Lbl B
"cos(X->Y1
Goto 0

Lbl C
"tan(X->Y1
Goto 0

Lbl D
"cot(X->Y1
Goto 0

Lbl E
"sec(X->Y1
Goto 0

Lbl F
"csc(X->Y1
Goto 0

Lbl 0
Input "At what angle? ",X
Output(2,1,Y1(X)


I know this code doesn't actually output this is in a table, but you can loop the above code as needed (minus the code at Lbl 0, of course) to draw it out.
KaluW_ wrote:
Do something like this:


Code:

Menu("Trig Identity","sin",A,"cos",B,"tan",C,"cot",D,"sec",E,"csc",F)
Lbl A
"sin(X->Y1
Goto 0

Lbl B
"cos(X->Y1
Goto 0

Lbl C
"tan(X->Y1
Goto 0

Lbl D
"cot(X->Y1
Goto 0

Lbl E
"sec(X->Y1
Goto 0

Lbl F
"csc(X->Y1
Goto 0

Lbl 0
Input "At what angle? ",X
Output(2,1,Y1(X)


I know this code doesn't actually output this is in a table, but you can loop the above code as needed (minus the code at Lbl 0, of course) to draw it out.


The reason I'm wanting to do this in a table-eqsue format is due to the undefined values like tan(90)
Answer to your question: Use a matrix.

Also,
Is this what your looking for?


Btw, I'm using the arrow keys to navigate between each window. (Up-Down for angles & Left-Right for trig ratios)

Here's the full blown-code (un-optimized of course):

Code:

Degree :ClrHome
{16,6}->dim([A]
{0,30,45,60,90,120,135,150,180,210,225,240,270,300,315,330}->L1

If [A](2,1)=0.5:Goto A

"sin(X)cos(X)tan(X)"->Str0
Fix 0
For(A,1,3)
   For(B,1,16)
      Output(1,1,"Building Assets...")
      Output(2,1,(A*16+B)/64*100)
      Output(2,4,"%")
      sub(Str0,(A-1)*3+1,3->{Y1}
      If (B=5 and A=3) or (B=13 and A=3)
      Then
         5->[A](B,A)
         0->[A](B,A+3)
         Goto 0
      Else
         {Y1}(L1(B)->[A](B,A)
      End
      
      If 0!={Y1}(L1(B)
      Then
         1/{Y1}(L1(B)->[A](B,A+3)
      Else
         5->[A](B,A+3)
      End
      
      Lbl 0
   End
End

Lbl A
"sincostancscseccot"->Str0
0->C:0->D
AxesOff:ClrHome:FnOff

Lbl AA
ClrDraw
TextColor(Blue)
Text(5,60+5,sub(Str0,3(C+1)-2,3))
Text(5,2*60+5,sub(Str0,3(C+2)-2,3))
Text(5,3*60+5,sub(Str0,3(C+3)-2,3))
For(A,1,3)
   For(B,1,8)

      TextColor(Black)
      If [A](B+D,A+C)=5
      Then
         Text(B*15+5,A*60+5,"und"
      Else
         Text(B*15+5,A*60+5,round([A](B+D,A+C),3))
      End
      
      TextColor(Blue)
      Text(B*15+5,5,L1(B+D))
   End
End

Repeat K!=0
   getKey->K
End
If K=24:0->C
If K=25:0->D
If K=26:3->C
If K=34:8->D
If K=45:Goto Q
Goto AA

Lbl Q
ClrHome


Note that you have to "build the assets" the first time you run the program (or after any RAM resets). This simply creates the matrix in which all the trig values are stored. I could have built it manually but I figured that it might be more convenient for the program to build it instead (since the matrix will be deleted in RAM resets, etc.).

Also: Degrees? Laughing
I swear the only place you ever see radians is in math. Physics or anywhere else, it's degrees. Nevertheless, I suggest you use radians instead of degrees in the program. I can still hear my Calculus teacher telling me "No, Josiah, not 45°, π/4 radians." Razz
KaluW_ wrote:
Answer to your question: Use a matrix.

Also,
Is this what your looking for?


Btw, I'm using the arrow keys to navigate between each window. (Up-Down for angles & Left-Right for trig ratios)

Here's the full blown-code (un-optimized of course):

Code:

Degree :ClrHome
{16,6}->dim([A]
{0,30,45,60,90,120,135,150,180,210,225,240,270,300,315,330}->L1

If [A](2,1)=0.5:Goto A

"sin(X)cos(X)tan(X)"->Str0
Fix 0
For(A,1,3)
   For(B,1,16)
      Output(1,1,"Building Assets...")
      Output(2,1,(A*16+B)/64*100)
      Output(2,4,"%")
      sub(Str0,(A-1)*3+1,3->{Y1}
      If (B=5 and A=3) or (B=13 and A=3)
      Then
         5->[A](B,A)
         0->[A](B,A+3)
         Goto 0
      Else
         {Y1}(L1(B)->[A](B,A)
      End
      
      If 0!={Y1}(L1(B)
      Then
         1/{Y1}(L1(B)->[A](B,A+3)
      Else
         5->[A](B,A+3)
      End
      
      Lbl 0
   End
End

Lbl A
"sincostancscseccot"->Str0
0->C:0->D
AxesOff:ClrHome:FnOff

Lbl AA
ClrDraw
TextColor(Blue)
Text(5,60+5,sub(Str0,3(C+1)-2,3))
Text(5,2*60+5,sub(Str0,3(C+2)-2,3))
Text(5,3*60+5,sub(Str0,3(C+3)-2,3))
For(A,1,3)
   For(B,1,8)

      TextColor(Black)
      If [A](B+D,A+C)=5
      Then
         Text(B*15+5,A*60+5,"und"
      Else
         Text(B*15+5,A*60+5,round([A](B+D,A+C),3))
      End
      
      TextColor(Blue)
      Text(B*15+5,5,L1(B+D))
   End
End

Repeat K!=0
   getKey->K
End
If K=24:0->C
If K=25:0->D
If K=26:3->C
If K=34:8->D
If K=45:Goto Q
Goto AA

Lbl Q
ClrHome


Note that you have to "build the assets" the first time you run the program (or after any RAM resets). This simply creates the matrix in which all the trig values are stored. I could have built it manually but I figured that it might be more convenient for the program to build it instead (since the matrix will be deleted in RAM resets, etc.).

Also: Degrees? 0x5
I swear the only place you ever see radians is in math. Physics or anywhere else, it's degrees. Nevertheless, I suggest you use radians instead of degrees in the program. I can still hear my Calculus teacher telling me "No, Josiah, not 45°, π/4 radians." Razz


Kind of. I Will make sure to use radians with this, but im curious as to whether using a string listing exact values would be possible. If not, this will work. (Think like how you can put sqrt(3)/2 as a string.)
  
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.

» Go to Registration page
Page 1 of 1
» All times are UTC - 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

 

Advertisement