# Adding vector functionality to TI Calculators

Although TI-83/84 calculators support multiple data types, such as real numbers, complex numbers, 1D and 2D lists, fuctions, etc., there is no data type for vectors. This program is my attempt to take the sequence three sequence functions (u v w), which are rarely used for their intended function, and transform them into two-dimensional vectors that can be expressed in terms of I and J.

In addition to adding vectors in terms of I and J, which can be operated on by most functions (including + - * / ^ and many more), functions have been added to determine (1) the angle between vectors, (2) the dot product of two vectors, and (3) the magnitude of a vector. The use of angle( has been altered to return the angle between to vectors, e.g. by angle(u,v. Also, * is now dot product (so uv is still implicit multiplication, but u*v is dot product). Finally, to get the magnitude of a vector, instead of absolute value notation ||u||, which only works with MathPrint, you should use brackets, for example, [u].

prgmVECTORS

ClrHome
1->I
While 1
{e->K
Input "",Str3
"I"+Str3"I·Ans·K
prgmQ
Ans->Str3
"?->Str4
If 2<length(Str3
sub(Str3,2,2->Str4
Str3+"·J·i
prgmQ
If inString("u=v=w=",Str4
"I"+sub(Ans,4,length(Ans)-3
If Str4="u=
Ans->u
If Str4="v=
Ans->v
If Str4="w=
Ans->w
Ans+"·angle(·cos¹(cos(abs(ΔList(angle({
prgmR
If "I["=sub(Ans,1,2) and "]I"=sub(Ans,length(Ans)-1,2
Then
expr(sub(Ans,3,length(Ans)-4
real(sqrt(Ansconj(Ans
prgmS
End
If inString(Ans,"*
Then
Ans+"·*·,
prgmR
expr("{"+Ans
prod(real(Ans))+prod(imag(Ans
prgmS
End
expr(Ans->K
If e≠LK(1
Ans(1->K
imag(Ans
If Ans
Then
prgmS
Ans->Str4
real(K
prgmS
Ans+"I+"+Str4+"J
If "0I"=sub(Ans,1,2
sub(Ans,4,length(Ans)-3
Ans+"·+~·-
prgmR
Disp sub("               ",1,16-length(Ans))+Ans
Else
Disp K
End
End


-> represents the arrow (0x04), · represents 0x81, ~ represents negation (0xB0), and L represents the list token (0xEB).

Also, prgmVECTORS calls on three subprograms. prgmS converts a real number to a string, prgmR replaces the first instance of one string with another, and prgmQ replace all instances of one string with another. They are shown below:

prgmQ

Ans→Str9
inString(Ans,"~
sub(Str9,Ans,length(Str9)-Ans+1→Str8
Str9
prgmR
Repeat Str9=Ans+Str8
Ans+Str8→Str9
prgmR
End


prgmR

Ans→Str0
inString(Ans,"~→Z
inString(Str0,"~",Ans+1→Y
inString(sub(Str0,1,Z-1),sub(Str0,Z+1,Ans-Z-1→X
sub(Str0,1,-1+inString(Str0,"~
If X
sub(Str0,1,X-1)+sub(Str0,Y+1,length(Str0)-Y)+sub(Str0,X+length(sub(Str0,Z+1,Y-Z-1)),Z-X-length(sub(Str0,Z+1,Y-Z-1


prgmS

{0,Ans->L2
{0,1->L1
LinReg(ax+b) r6
Equ>String(r6,Str1
sub(Str1,1,length(Str1)-3