Search code examples
syntax-errorti-basic

Ti-84 syntax error relating to a single list conversion to a matrix


:N-remainder(dim(L1),N→ dim(L2)
:Fill(23,L2
:augment(L1, L2->L1

:{1,1→dim([A]
:For(x,1,dim(L1)/N
:augment([A],List▶matr(seq(L1(I),I,Nx-N+1,Nx),[B]
:End

I get a syntax error when running this Ti-basic code and I cannot figure out why (happens somewhere when List is being converted to matrix). Basically this code is suppose to take a L1 (add 23 until I dim(L1) is a multiply of N), then create a matrix with N rows and -int(-dim(L1)/n) columns.

Example:

Let N=3 and L1 = {9,12,15,22,5,9,14,4,9,1,14,7,9,18,12,19}

dim(L1) = 16 which is not a multiply of 3 (18 is so add 23 to L1 twice)

L1 = {9,12,15,22,5,9,14,4,9,1,14,7,9,18,12,19,23,23}

dim(L1) = 18 which is a multiple of 3

Create a 3x6 matrix with Col1 = {9,12,15}, Col2 = {22,5,9}, ..., Col6 = {19,23,23}

http://tibasicdev.wikidot.com/forum/t-1039272/comments/show?from=activities#post-2131820 Read full convo. here


Solution

  • There are at least two issues with your code:

    (1) For the augment command both matrices must share the same number of rows. In your program matrix [A] is set to dimension {1,1} (Why?), but the columns you want to append are of different size. So you'll get a "dimension error".

    (2) The List▶matr command doesn't return a matrix (actually it doesn't return anything). So you can't use it as second parameter for the augment command. Instead you must run it first and then use something like augment([A],[B])▶[C].