Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: holmes221b on December 09, 2010, 03:10:39 pm

Title: Inputting Data into a Matrix
Post by: holmes221b on December 09, 2010, 03:10:39 pm
I was flipping through my pre-calculus textbook the other day and I came across a problem involving cryptography and matrices, specifically something called a Q32 Fibonacci encryption matrix. Being the sort of person I am, I immediately decided I needed to code a TI-BASIC program utlizing this method of encryption.
But the only problem is that I can't seem to figure out/remember how to input data into a matrix--I keep getting either ERR: DIM or ERR: DATA TYPE for the key matrix, no matter what I try.

And how would one go about inputting user selected variables into a matrix? I've currently got the following bit of code in my cal for this, but until I can figure out how to input data into a matrix the code remains untested.
Code: [Select]
:Prompt A,B,C,D,E,F,G,H,I
:[[A,B,C][D,E,F][G,H,I]]->[J]
Title: Re: Inputting Data into a Matrix
Post by: AngelFish on December 09, 2010, 03:12:27 pm
Did you make sure you're using the [J] token and not just typing it in?
Title: Re: Inputting Data into a Matrix
Post by: holmes221b on December 09, 2010, 03:14:13 pm
I am using the token.
Title: Re: Inputting Data into a Matrix
Post by: AngelFish on December 09, 2010, 03:25:53 pm
Yeah, I can't get it to work either.
However, you can do

Code: [Select]
Listâ–¶matr({A,D,G},{B,E,H},{C,F,I},[J]
and it will store them to the matrix.
Title: Re: Inputting Data into a Matrix
Post by: FinaleTI on December 09, 2010, 03:28:42 pm
I just tested the code from the first post on my calc and it works perfectly.
Title: Re: Inputting Data into a Matrix
Post by: holmes221b on December 09, 2010, 03:32:38 pm
Huh, whatever was the problem with the code when I first tried it, it's working now that I've added a menu to the program. xD

Thanks for your help though. I might just use your suggestion anyways in this code, it looks much neater than storing the values straight to the matrix.
Title: Re: Inputting Data into a Matrix
Post by: DJ Omnimaga on December 09, 2010, 05:46:01 pm
This code is neat, because it doesn't update the Ans variable, thus, less risks of ERR:MEMORY messages under low RAM conditions.