+ Reply to Thread
Results 1 to 3 of 3

Thread: TI 82 calculator tutorials Part 4 - Matrixes and Lists

  1. #1
    Join Date
    Apr 2009
    Location
    Uppsala, Sweden
    Posts
    9,547
    Blog Entries
    5
    Rep Power
    98

    TI 82 calculator tutorials Part 4 - Matrixes and Lists

    In this series of tutorials I will teach you how to program in a TI 82 calculator from the very basics. I use a TI 82 calculator and therefor I also use it for my examples but many different Texas Instruments calculator has nearly the same syntax so you don't have to use it with a TI 82.
    All my knowledge I have got by testing on boring math lessons so I've tried a lot and know what to do and what you shouldn't do.

    Parts in this series:

    Anyway, let's start with Part 4 - Matrixes and Lists.



    Matrixes and Lists are two ways to store a lot of data, the Matrixes uses 2 dimensions while Lists only use one.



    Matrixes:

    Matrixes hold numbers in a two dimensional storage, you get and set the value of one of the values by referring to its index(width and height).

    There are a total of 10 Matrixes you can use, named from [A] to [J], to access them and also a list of the functions, press the MATRX button.



    TI 82 calculator tutorials Part 4 - Matrixes and Lists-ti-82-matrx.jpg


    To create a new one we do this:

    Code:
    {5,5}->dim([A])
    We then creates a Matrix with 5 in width and 5 in height and store is as Matrix [A], this means matrix [A] has room for 25(5*5) values.


    Now if we want a value from the Matrix, for example, at position 3,2, we just referrer to that position like this:

    Code:
    [A](3,2)
    We can do the same when we set the value:

    Code:
    7->[A](3,2)

    Just to show another example on how to do this I give you a little more complex example:


    Code:
    {5,5}->dim([A])
    
    For(X,1,5,1)
    For(Y,1,5,1)
    
    X*Y->[A](X,Y)
    End
    End
    
    Prompt (X)
    Prompt (Y)
    
    Disp [A](X,Y)
    We using a nested for loop to create a multiplication table(X position multiplied with Y position is equals to the stored value at that position). Then the user can select a X value and a Y value and the value at that index in [A] is displayed. Observe that if X or Y is not between 1 and 5 an error will occur since there's no value at that index, this can be avoided by just make the game check the X and Y variables with an If statement before.


    When working with Matrixes you can use function which randomly fill the matrix, function to add rows and swap them and so on, but we won't go through that.






    Lists:


    To access the list of your Lists and all functions for lists press the "2nd" button and then the "STAT" button.


    TI 82 calculator tutorials Part 4 - Matrixes and Lists-ti-82-list.jpg


    Lists holds a lot of data in a long line of values, list are only using one dimensional. A good thing with lists is that you can create as many of them as you like, you just use a custom name for them.


    To declare a new one, it's just to use the length we want and stores it like this:

    Code:
    5->dim(LTEST)
    (the L in the name is actually a smaller L just indicating it's a list)


    This code creates a new List called TEST with a total of 5 elements. If the list already exists the length is just changed.


    To access the value we just referrer to the position we want to get the value from, like this example:


    Code:
    Disp LTEST(3)
    That displays the value at position 3 in the list, in the same way we can also set the values:


    Code:
    25->LTEST(3)
    Now we add 25 as the value at position 3 in the list.


    As I did with the Matrixes I can give you a little more complex example here too:


    Code:
    5->dim(LTEST)
    
    25->LTEST(1)
    16->LTEST(2)
    8->LTEST(3)
    11->LTEST(4)
    19->LTEST(5)
    
    0->C
    For(I,1,5,1)
    
    If LTEST(I)>14
    C+1->C
    
    End
    
    Disp "PUPILS PASSED:"  
    Disp C

    This code above creates a list with 5 elements and gives them different values. Then with a for loop the program check if each element's value is greater then 14, if this is the case, the variable C is increase by 1. Then the results are displayed.


    When using lists we can use functions to sort the elements, get random lists and so on. But we won't learn that now.



    Now we're done here, let's finish this off in Part 5.
    Last edited by Vswe; 08-28-2009 at 04:21 PM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: TI 82 calculator tutorials Part 4 - Matrixes and Lists

    Getting better and better. +rep

  4. #3
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: TI 82 calculator tutorials Part 4 - Matrixes and Lists

    This is where I think the HP calculators get better. They can disassemble and reassemble matrices on the fly. +rep
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 08-28-2009, 07:35 PM
  2. Replies: 2
    Last Post: 08-28-2009, 07:30 PM
  3. Replies: 2
    Last Post: 08-28-2009, 07:28 PM
  4. Replies: 6
    Last Post: 08-28-2009, 07:27 PM
  5. Intermediate ADTs: Stacks and Queues Part 2: Using Lists
    By WingedPanther in forum C Tutorials
    Replies: 4
    Last Post: 01-09-2009, 12:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts