Home TI-Nspire Authoring Create Your Own TI-Nspire Dynamic Tables Template

    
     

Create Your Own TI-Nspire Dynamic Tables Template

TNS sampler documents

                   

So you know how to create dynamic tables. Now it would be nice if you could quickly and easily create such tables from any data - not just formulas, but even data from the Internet.

The secret here is to use the Lists & Spreadsheet application to easily create our lists. Remember, any data placed in cells of a column which is named is automatically a list. And using the program developed previously, several lists can be turned into a matrix and, subsequently, a dynamic table.

Creating Your Data Repository

Begin in the usual way, with a title page, split to allow the hidden Notes window from which our program will run. Then another Notes page for instructions, but split this one vertically to share with a Lists & Spreadsheet window. Our data sets will be labelled list1, list2, etc. This is necessary in order for our program to be able to find and work with these. Give them different names and this will not work.

We will begin with a simple example: three lists of numbers: the counting numbers, their squares and their cubes. Label list1 and define it as seq('k,'k,1,50). Now label and define list2 as list1^2 and list3 as list1^3.

Once we have created our program, we can insert any data we like into these lists - and define additional lists as required. For example, list1 could be the names of the elements, or the planets, and the other lists contain data related to this. Note that the dimension of list1 (the number of elements in the list) will be the one that we use to drive our program. All other lists MUST have at least as many elements as list1. If any have less, then you need to complete these, or the table program will throw errors.

Finally, once you have inserted your data for a particular document, then using ctrl-k and delete the entire spreadsheet can be deleted. Once the lists are defined and named, as long as they do not change, then all will work perfectly without them.

Creating Your Program

In many ways, this program is a simpler version of the one developed previously, since we do not need to generate our lists - this is already done for us. But we do need to know how many lists to look for, and so we set an argument, num, which feeds the number of lists into the program.

For our table to be built, a couple of things need to happen. First, we need to go through the first element of each list and put these into a new list (called list here!). So for k running from 1 to 3, we need list1[1], list2[1] and list3[1] to be joined (augmented) into a new list.

We know how to do this using the augment command: begin with an empty list, then augment the elements to build the new one.

The tricky bit is to refer to the correct number of lists, and for this a little indirection will serve nicely. Study the program and make sure you can understand what is happening at each step. NOTE the two For..Endfor loops: one, (k, counts off the number of lists, num. The other, m, counts the number of lines in our table. Initially, we will build a table that goes all the way from 1 to whatever the dimension of list1 happens to be!

So for the first line of the table (when m=1), k runs from 1 to 3, taking the empty list first and augmenting the first element of lists1, 2 and 3:

list:=augment(list,{list1[1],list2[1],list3[1]})

The program then does this for each line of the table, and finally, turns the long table into a matrix with num columns, as required.

Define table(num,show)=

Prgm

Local k,m,list

list:={}

For m,1,dim(list1)

For k,1,num

expr("list:=augment(list,{list"&string(k)&"["&string(m)&"]"&"})")

EndFor

EndFor

display:=list>mat(list,num)

EndIf

EndPrgm

So all that remains is to change the span of the matrix from 1 to dim(list1) to run in line with our show slider (created as per the previous instructions). As shown, copy the two For..EndFor loops and set them up for the two conditions: when the number of elements to be displayed is less than 9, or greater than 9.

I added one more safety check: what would happen if we have show running up to 50, but the lists only have 10 or 20 elements? This would not be good, so I thought a check would be in order.

Finally, since we might want to display our tables on more than just the handheld, what about a new variable called span that allows us to change the display length from the current value of 9? This could be inserted as a slider, or simply entered in the program, as shown.

So now go ahead and experiment: some Internet data sites work better than others for copying and pasting into our spreadsheet, but it opens the doors to great things!


           

©2009 Compass Learning TechnologiesHome TI-Nspire Authoring Create your own Dynamic Tables Template