(Somewhat) useful TI-BASIC scripts

These scripts are written for a TI-85, so there are modern counterparts to many of these commands.
Note: -> represents the STO> key.

Dependencies

PRMTVECS

Prompts for two 3D Vectors as U/V XYZ.

Prompt UX,UY,UZ,VX,VY,VZ
			
DOTPROD

A 3D Dot Product calculator

PRMTVECS

(UX*VX)+(UY*VY)+(UZ*VZ)->DP

Disp DP
			

Programs

BASECONV

A Base Converter that works from bases 2-10. Other bases are undefined behavior.

ClLCD

Input "DIGITS: ",D
Input "NUM: ",A
Input "SRC BASE: ",B
Input "DEST BASE: ",F

O->T
O->C

For(J,0,D-1)
int(A/(10^(D-1-J)))->C
C*B^(D-1-J)+T->T
A-C*10^(D-1-J)->A
End

1->P
0->E
For(K,0,15)
int(T/(F^(15-K)))->E
Outpt(5,P,E)
T-(E*F^(15-K))->T
P+1->P
End
Disp ""
BASELOG

A calculator that solves logarithmic expressions of form logB(A) = E

Disp "BASE - 1","ARGUMENT - 2","EXPONENT - 3","WHICH NEEDED? "
Prompt Z

If(Z==1)
Then
Prompt A,E
Disp (E^x√A)
End

If(Z==2)
Then
Prompt B,E
Disp (B^E)
End

If(Z==3)
Then
Prompt B,A
log A->T1
log B->T2
Disp (T1/T2)
End
BOUNCE

An animation that bounces a pixel across your graph screen

ClLCD
ZStd
ZSqr
AxesOff
DispG

0->A
0->B
e^(-1)->C
π^(-1)->D

While (1==1)
If A>=17 or A<=-17
C*-1->C
If B>=10 or B<=10
D*-1->D
A+C->A
B+D->B
PtChg(A,B)
End
CROSPROD

3D Cross Product calculator

PRMTVECS

((UY*VZ)-(UZ*VY))->I
((UX*VZ)-(UZ*VX))*-1->J
((UX*VY)-(UY*VX))->K

Disp I,J,K
DIST

A 3D Distance calculator

PRMTVECS

√((VX-UX)^2+(VY-UY)^2+(VZ-UZ)^2)->O

Disp O
FACTORS

A program that prints the factors of a number

Prompt N

For(I,2,N,1)
Disp I,(N/I)->Frac,"-----"

Pause
End
			
FIBON

A program that generates fibonacci numbers

Prompt N
If N==-1
Then
0->ONE
0->TWO
1->LAST

Disp 0,1

While 1==1
Pause
Disp TWO+LAST

LAST->TWO
ONE+TWO->LAST
TWO->ONE

End
Else
.5(1+√(5
(Ans^N-(-Ans)^-N)/√5
			
FLX2SURF

A calculator for determining the flux through a surface

Prompt E,A,THETA
Disp E*A*cos THETA
			
FVPTSUMM

A calculator for determining the five-point summary of a sequence of numbers stored in xStat. Modified from this implementation.

5 -> dimL q5s
sortA xStat -> qL

min(qL) -> q5s(1)
max(qL) -> q5s(5)

dimL qL -> QSIZE

QSIZE / 2 -> QQL

If fPart QQL ≠ 0
(qL(iPart QQL) + qL(iPart QQL + 1)) / 2 -> q5s(3)

If fPart QQL == 0
qL(QQL) -> q5s(3)

.25 * QSIZE -> QQL

If fPart QQL ≠ 0
qL( iPart QQL + 1 ) -> q5s(2)

If fPart QQL == 0
(qL(QQL) + qL(QQL + 1)) / 2 -> q5s(2)

.75 * QSIZE -> QQL

If fPart QQL ≠ 0
qL( iPart QQL + 1 ) -> q5s(4)

If fPart QQL == 0
(qL(QQL) + qL(QQL + 1)) / 2 -> q5s(4)

For(I,1,5)
Disp q5s(I)
End
			
INTEGRAL

A wrapper function for the fnInt function

Disp "LOAD FUNC IN y1"

Prompt LO,HI

Disp fnInt(y1,x,LO,HI)
			
POLCART

A program that converts between Cartesian and Polar coordinates

Disp "P2C (1) OR C2P (2)"
Prompt A

If A==1
Then
Prompt R,T

Disp "X:",R*cos T
Disp "Y:",R*sin T

Else
Prompt X,Y

Disp "R:",√(X^2+Y^2)
Disp "T:",tan^-1(Y/X)

End
			
POLDIST

A Polar distance calculator

Prompt R1,T1,R2,T2

Disp √(R1^2+R2^2-2(R1)(R2)cos (T1-T2))
			
PONG

A basic 1-player Pong implementation

3->M
20->X
1->S
1->T
0->C

abs (int ((rand*10)-8))->Y

Repeat K==16 or X==1 and M/=Y
ClLCD

Outpt(M,1,"[")
Outpt(1,1,C)
Outpt(Y,X,"O")

getKy->K

max(1,min(8,M+(Ans==34)-(Ans==25->M
T(Y>1 and Y<8)+(Y==1)-(Y==8->T
S(X>1 and X<21)+(X==1)-(X--21->S

X+Ans->X
Y+T->Y

If (X==1)
Then
C+1->C
End
End

Pause "GAME OVER"
ClLCD:""

If (C>HISCORE)
Then
C->HISCORE
Disp "NEW HIGH SCORE!",C
End

If (C<=HISCORE)
Then
Disp "SCORE:",C
Disp "HIGH SCORE:",HISCORE
End
			
PROJECT

A 3D Vector projection calculator

Disp "V ONTO U"

DOTPROD
√(UX^2+UY^2+UZ^2)->MAG
DP/MAG->SP

Disp UX*SP/MAG->Frac
Disp UY*SP/MAG->Frac
Disp UZ*SP/MAG->Frac
Disp "SP",SP
QUADR

A calculator for the quadratic formula

Prompt A,B,C

0->x1
0->x2

((-1*B)+√((B^2)-(4*A*C)))/(2*A)->x1
((-1*B)-√((B^2)-(4*A*C)))/(2*A)->x2

Disp x1,x2
			
SUMCALC

A wrapper for the sum function

Disp "PUT EXPR IN y1"

Prompt LO
Prompt HI
Prompt STEP

Disp sum (seq(y1,x,LO,HI,STEP))
			
VECSANGL

A calculator to find the angle between vectors

DOTPROD
√(UX^2+UY^2+UZ^2)->UMAG
√(VX^2+VY^2+VZ^2)->VMAG

Disp cos^1(DP/UMAG/VMAG)