Project Name: Jack's Opening Animation and Logarithmic Program



Going into this project, I had never used or worked with TI-Basic, Basic, or Texas Instrument Programmable Calculators. I personally own a TI-34 which is way down the ladder, but I have friends who have TI-83s and 84s. I learned about their ability to be programmed but never took action and had a reason to up until this week when we learned about logarithms. I know, I'm a math novice because I am only in Algebra 2, but it comes easy to me and is enjoyable. I couldn't get past the fact that a process like finding log(3)8=x could be automated using a program so I found this site and wrote one using documentation from www.tibasicdev.wikidot.com.

So far I've written an animation, subprogram definable function, and logarithm program. The most complex would be the definable function with lists because it has the steepest learning curve. The basic premise is that the prgmLOG calls on prgmNAMEANIM to do an intro to the program. While making prgmNAMEANIM, I discovered a cool trick using FOR combined with PT-ON so I wrote a customizable function for it that takes six arguments with a switcher variable in the list.

The Pathway: prgmLOG -> prgmNAMEANIM -> prgmFUNCPNT -> prgmNAMEANIM -> prgm FUNCPNT -> prgmNAMEANIM -> prgmLOG

LOG Program

Code:
prgmNAMEANIM
ClrDraw
Lbl 6
"LOGARITHM SOLVER"->Str1
"log(b)X=Y"->Str2
ClrHome
Menu(Str1,Str2,1,"Find b",2,"Find X",3,"Find Y",4,"Quit",5)
Lbl 5:Stop
Lbl 1:Goto 6
Lbl 2
Disp Str1:Disp Str2
Input "X: ",X
Input "Y: ",Y
X^(1/Y)->B
Disp "b: ",B
Goto 7
Lbl 3
Disp Str1:Disp Str2
Input "b: ",B
Input "Y: ",Y
B^Y->X
Disp "X: ",X
Goto 7
Lbl 4
Disp Str1:Disp Str2
Input "b: ",B
Input "X: ",X
ln(X)/ln(B)->Y
Disp "Y: ",Y
Lbl 7

NAMEANIM Program

Code:
ClrDraw:AxesOff
{3,4,9,1,1,0,6}->|LPNT
0->X
For(A,1,24
Text(A,42,"The
End
For(A,1,19
Text(31,A+10," Rascal
Text(31,71-A,"Jack
End
For(A,~10,~2.75,.325)
Horizontal ~A
Horizontal A
End
Repeat 0
rand(50)
Text(53,34," [ENTER]")
rand(50)
prgmFUNCPNT
If getKey or |LPNT(6):Then
Text(53,38," OKAY!")
rand(50)
{2.4,4,9,1,0,0,6}->|LPNT
prgmFUNCPNT
rand(10)
Return
End:End

FUNCPNT Program

Code:

//Checks if List is Empty
If dim(|LPNT)<1:Then
Disp "ERROR: "
Disp "List Empty"
Stop
End

//Setup for Function
0->|LPNT(6)
Pt-Off(0,abs(|LPNT(2)+20),|LPNT(7))

//Converts Height from 1.25 to .25 depending on Pixels or Points X,Y
If |LPNT(4):Then
1.25->H
Else
.25->H
End

//Main Brain of Function
For(X,0,|LPNT(1),.6)
For(Y,|LPNT(2),|LPNT(3),H)
If getKey
1->|LPNT(6)
If |LPNT(4):Then
Pt-On(X,((Y*DeltaY)-abs(Ymax)),|LPNT(7))
Pt-On(~X,((Y*DeltaY)-abs(Ymax)),|LPNT(7))
Else
Pt-On(X,Y,|LPNT(7))
Pt-On(~X,Y,|LPNT(7))
End
If |LPNT(5) and |LPNT(6)=1 and X=|LPNT(1) and Y=|LPNT(3):Then
Return
End:End:End

//List Guidelines
//1. Width in Points
//2. Starting Height
//3. Stopping Height
//4. Height Type:True is Point, False is Pixel
//5. getKey Option On/Off
//6. getKey Option Variable:1=getKey pressed while in Function, Should be defined 0 in Program
//7. Type of Pt Brush:6 is the Recommended Brush


Feel free to leave feedback because I need tips and tricks since I'm new. My background is Lua and Java, but I'm learning Objective-C and Swift. I also can use JavaScript and HTML only with Documentation on the side. I love to code, and so far this has been an awesome project to dive into and figure out. Thanks to everyone who answered my questions in the chat!
Nice work, this is looking good! Just note that closing parentheses and quotes are not necessary if they're followed by a newline, colon or → (STO arrow), and that Disp arguments can be chained together with commas. So, to save space, the first few lines of that last program could be:

Code:

If 1<dim(|LPNT:Then
Disp "ERROR: ","List Empty
Stop
End

//Setup for Function
0->|LPNT(6
Pt-Off(0,abs(|LPNT(2)+20),|LPNT(7

I'll have more later!
Your programs seem pretty well optimized. Looking at the first program (prgmLOG), I see that you stored two strings to save a few bytes.

After a bit of optimizing, I have this for your first program.


Code:
ClrDraw
"LOGARITHM SOLVER→Str1
"log(b)X=Y→Str2
1                                 //sets Ans to 1
Lbl 1
Menu(Str1,Str2,1,"Find b",2,"Find X",3,"Find Y",4,"Quit",5
Lbl 5:Stop
Lbl 4:Ans+1                       //1+1=2 and move on to Lbl 3
Lbl 3:Ans+1                       //Ans+1=? and move on to Lbl 2
Lbl 2:Ans→A                       //If Lbl 2, A=1;If Lbl 3, A=2;If Lbl 4, A=3
ClrHome
Disp Str1,Str2
Input sub("bX",1+(A=1),1)+": ",B
Input sub("XY",2-(A=3),1)+": ",C
If A=1:B^(Cˉยน                     //inverse is a bit faster than dividing
If A=2:B^C
If A=3:ln(C)/ln(B
Disp sub("bXY",A,1)+":",Ans


It uses only three real variables while keeping the same UI. I combined the three choices/labels into one.

By the way, what calculator are you testing this on? If it is a MathPrint OS, then log(<number>,<base> will work.
I have rewritten most of the code to function better. The LOG program now uses values instead of Lbl and Goto. The FUNCPNT program now uses a friendly graphing window along with the NAMEANIM. I got this idea from http://tibasicdev.wikidot.com/friendly-window.

As for the replies, thank you for the tips. Even though it wastes RAM, I am not going to stop closing parenthesis and quotes because I don't want to develop bad programming habits for other languages. I did however change my program to use the inverse rather than division.

EDIT* Looked into the Sub( command, and it is really useful in this program. Thanks for pointing that out. At first I didn't understand the 1+(N=1) then I realized that if N!=1 then it would output 0 so it would be 1+0. That also saves some space and time.

EDIT2* Added more customization after realizing that in the original program it expanded by 3 pixels not 1. So I added the Rate of Expansion argument for both X and Y. Also fixed typo where in //List the X value said Starting Height not Stopping Width.

EDIT3* Changed Animation Rate of X Expansion to 2 to match Original Code. Added GIF of updated Program.



LOG Update

Code:
prgmNAMEANIM
ClrDraw
"LOGARITHM SOLVER"->Str1
"log(b)X=Y"->Str2
Lbl 1
0->N
ClrHome
Menu(Str1,Str2,1,"Find b",2,"Find X",3,"Find Y",4,"Quit",5)
Lbl 5:Stop
Lbl 4:N+1->N
Lbl 3:N+1->N
Lbl 2:N+1->N
ClrHome
Disp Str1,Str2
Input sub("bX",1+(N=1),1)+": ",B
Input sub("XY",2-(N=3),1)+": ",C
If N=1:B^(C^^-1)
If N=2:B^C
If N=3:ln(C)/ln(B)
Disp sub("bXY",N,1)+":",Ans


NAMEANIM Update

Code:
ClrDraw:AxesOff
ZStandard
84->Xmin
~72->Ymin
ZInteger
{33,61,2,~58,~54,1,1,0,6}->|LPNT
0->X
For(A,1,24
Text(A,42,"The
End
For(A,1,19
Text(31,A+10," Rascal
Text(31,71-A,"Jack
End
For(A,~62,~40,1)
Horizontal A
Horizontal (~A-62)
End
Repeat 0
rand(50)
Text(53,34," [ENTER]")
rand(50)
prgmFUNCPNT
If getKey or |LPNT(8):Then
Text(53,38," OKAY!")
rand(50)
{33,61,2,~58,~54,1,0,0,6}->|LPNT
prgmFUNCPNT
rand(10)
Return
End:End

//List Guidelines
//1. Starting X Width
//2. Stopping X Width
//3. Rate X Expands
//4. Starting Y Height
//5. Stopping Y Height
//6. Rate Y Expands
//7. getKey Option On/Off
//8. getKey Option Variable:1=getKey pressed while in Function, Should be defined 0 in Program
//9. Type of Pt Brush:6 is the Recommended Brush


FUNCPNT Update

Code:

//Checks if List is Empty
If dim(|LPNT)<1:Then
Disp "ERROR: "
Disp "List Empty"
Stop
End

//Setup for Function
0->|LPNT(8)
Pt-Off(((|LPNT(1)+|LPNT(2))/2),2,|LPNT(9))

//Main Brain of Function
For(X,((|LPNT(1)+|LPNT(2))/2),|LPNT(1),~|LPNT(3))
Z+abs((|LPNT(3)*2))->Z
If X=47:0->Z
For(Y,|LPNT(4),|LPNT(5),|LPNT(6))
If getKey:1->|LPNT(8)
Pt-On(X,Y,|LPNT(9))
Pt-On((X+Z),Y,|LPNT(9))
If |LPNT(7) and |LPNT(8)=1 and X=|LPNT(1) and Y=|LPNT(5):Then
Return
End:End:End

//List Guidelines
//1. Starting X Width
//2. Stopping X Width
//3. Rate X Expands
//4. Starting Y Height
//5. Stopping Y Height
//6. Rate Y Expands
//7. getKey Option On/Off
//8. getKey Option Variable:1=getKey pressed while in Function, Should be defined 0 in Program
//9. Type of Pt Brush:6 is the Recommended Brush


Reasoning for leaving a gap on Line 1 of FUNCPNT is due to a bug in SourceCoder3 that transfers a comment on Line 1 for some reason.
  
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