how to enter a matrix into a TI-Nspire program?

461 views
Skip to first unread message

t...@tomreardon.com

unread,
Jul 4, 2018, 3:41:38 PM7/4/18
to tins...@googlegroups.com, Tom Reardon
Hello.

I am trying to write a program that will create a matrix and then put values in it.
I have been successful doing this on the 84, but not on the Nspire.

For example, I want to create matrix A to be a 2 x 2 matrix with
a[1,1] = 3
a[1,2] = 4
a[2,1] = 5
a[2,2] = 6

I used
{2,2}→dim([A])
to create the matrix. Is that correct syntax?

Are matrices names case sensitive?

I then tried to store values into the elements of the matrix using the store arrow.
I keep getting a syntax error.

Help?

Thanks.

Tom

Marc Garneau

unread,
Jul 4, 2018, 3:57:20 PM7/4/18
to tins...@googlegroups.com, t...@tomreardon.com
Hi Tom,

My matrix skills are limited, but from a programming perspective, it may be easier to generate your values into a list, then use the list to matrix conversion command.

For example, A:=list►mat({3,4,5,6},2)

Marc

--
--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/classroom-news/welcome-abouttime

---
You received this message because you are subscribed to the Google Groups "tinspire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinspire+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

eagl...@duetsoftware.ca

unread,
Jul 4, 2018, 8:09:36 PM7/4/18
to tins...@googlegroups.com, t...@tomreardon.com
Hi Tom,

What you have done is not correct, but it's on the right track.  A matrix, as far as computers are concerned, is a 2D array, or a list of lists.  So you can make a matrix by making a list where each element is a row of the matrix as a list.
Eg: a := {{1,2,3},{4,5,6}}

 Variable names are not case sensitive, so A and a are the same.

To alter the value of one element, you did have that correct, but you were missing the ":".
a[row,col] := value.

I can't remember if there's a specific way to generate a blank matrix like this (not using the template) - probably not since you can't store a blank template - but you can either make the matrix with all zeroes and then replace, or add in the values on the fly as you create.  If the matrix is of fixed size, however, could you not just use the template (honest question - I've never tried this in a program)?

Also check out colAugment which might be helpful:
ColAugment(rowMatrix1, rowMatrix2)
ColAugment({{1,2,3}}, {{4,5,6}}) creates the same matrix as my first example

  --Eric

John Hanna

unread,
Jul 10, 2018, 6:42:49 AM7/10/18
to tins...@googlegroups.com, t...@tomreardon.com

Greetings, folks,

I’ve been working with a large (20x30 matrix) and found that newMat(20,30) is the fastest way to create the matrix filled with 0’s. In the Catalog this is seen as ‘Zero Matrix’.

 

You can use the matrix template within the Program Editor:

but you will have to enter the values (or expressions) for each element.

To access elements use the syntax m[r,c].

To increase the size of the matrix use augment( ) or colAugment( ).

To decrease the size use submatrix( ).

 

Regards,

         John

image001.png
Reply all
Reply to author
Forward
0 new messages