[ti basic] matrix manipulation

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
Loki
Extreme Poster
Posts: 314
Joined: Thu 18 Aug, 2005 7:01 pm
Location: My world is in grayscale, but if i stand still long enough, i see it in black and white.
Contact:

[ti basic] matrix manipulation

Post by Loki »

How do you manipulate and access data in a matrix?
Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

For matrics:
BASIC Code wrote::ClrHome
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1][1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1][1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1][1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1][1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1][1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1Image[A]
:For(A,1,8
:For(B,1,16
:Output(A,B,sub(" O",[A](A,B)+1,1
:End
:End
:2ImageA:2ImageB
:[A](A,B
:Repeat Ans=1
:Repeat Ans
:getKeyImageImage
:End
:AImageC:BImageD
:B+(Image=26)-(Image=24ImageB
:A+(Image=34)-(Image=25ImageA
:If [A](A,B:Then
:CImageA:DImageB:End
:Output(C,D,"
:Output(A,B,"O
So you just want to change a number, then just [A](A,B
such as I want a 3 to be in the 1,1 position then I would 3->[A](1,1
CompWiz
Calc King
Posts: 1950
Joined: Thu 13 Oct, 2005 1:54 pm
Location: UB

Post by CompWiz »

There's a whole section in the manual about it. If you don't have a manual(or have the mini 84 series manual), here is the 83+/SE manual, and here is the complete 84+/SE manual. Chapter 10 deals with matrixes.
In Memory of the Maxcoderz Trophy Image
User avatar
Loki
Extreme Poster
Posts: 314
Joined: Thu 18 Aug, 2005 7:01 pm
Location: My world is in grayscale, but if i stand still long enough, i see it in black and white.
Contact:

Post by Loki »

Aha, I got it now. Thanks! Never used matrices before, so...
Image
Liazon
Calc Guru
Posts: 962
Joined: Thu 27 Oct, 2005 8:28 pm

Post by Liazon »

Aha, I got it now. Thanks! Never used matrices before, so...
You mean you've never used them in programming right? Because matrices have mathematical uses, or so they say...
Image Image Image
User avatar
Loki
Extreme Poster
Posts: 314
Joined: Thu 18 Aug, 2005 7:01 pm
Location: My world is in grayscale, but if i stand still long enough, i see it in black and white.
Contact:

Post by Loki »

Never used them period. Never really felt the need to...still dont, but i figured i'd learn now so i'll know when the time comes
Image
User avatar
Loki
Extreme Poster
Posts: 314
Joined: Thu 18 Aug, 2005 7:01 pm
Location: My world is in grayscale, but if i stand still long enough, i see it in black and white.
Contact:

Post by Loki »

Ok, so how exactly would you use them on an 89Ti?
Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

You might want to get help from http://www.unitedti.org, as they have many 68k programmers.
User avatar
Loki
Extreme Poster
Posts: 314
Joined: Thu 18 Aug, 2005 7:01 pm
Location: My world is in grayscale, but if i stand still long enough, i see it in black and white.
Contact:

Post by Loki »

Wow, i thought I was the only one up at 2 30 posting about calc stuff o.o thanks, too
Image
User avatar
KermMartian
Calc Wizard
Posts: 549
Joined: Tue 05 Jul, 2005 11:28 pm
Contact:

Post by KermMartian »

Ha! You thought wrong. :)
Image Image Image
DarkerLine
Calc Wizard
Posts: 526
Joined: Tue 08 Mar, 2005 1:37 am
Location: who wants to know?
Contact:

Post by DarkerLine »

Loki wrote:Ok, so how exactly would you use them on an 89Ti?
Close to the same deal:

Code: Select all

[[1,2][3,4]]->mat1
another method of storing matrices:

Code: Select all

[1,2;3,4]->mat2
create a 2x3 matrix filled with zeroes:

Code: Select all

newMat(2,3)->mat3
you can use seq( commands to create matrices as well:

Code: Select all

seq(seq(i*j,j,1,2),i,1,2))->mat4
you can mix variable types in matrices:

Code: Select all

["hello",x+1;-5,"world]
get an element of a matrix:

Code: Select all

mat1[1,2]
you store to elements in the same way:

Code: Select all

"matrices are fun"->mat1[1,2]
stick two matrices together side-to-side:

Code: Select all

augment(mat1,mat2)
stick two matrices together top-to-bottom:

Code: Select all

augment(mat1;mat2)
Getting the size of a matrix:

Code: Select all

dim(mat1)
returns a list, in this case {2,2} of the row and column size

Code: Select all

rowDim(mat1)
returns the size of a row

Code: Select all

colDim(mat1)
returns the size of a column

you can't store to dim(), rowDim(), or colDim(). However, you can use augment to increase a matrix's size. To get a submatrix, use:

Code: Select all

subMat(mat1,startRow,StartCol,endRow,endCol)
There are many more functions like these, consult the TI-89 manual available from TI's website and Google.

You might want to get help from http://www.unitedti.org, as they have many 68k programmers.
We do visit maxcoderz occasionally as well.
just try to be nice to people.
_________________
My TI Blog - http://mpl.unitedti.org/
Post Reply