# Two Matrix Questions

math matrix equations

3 replies to this topic

### #1 AussieGuy

AussieGuy

Newbie

• Members
• 14 posts

• Calculators:

Posted 29 March 2013 - 01:22 PM

I'm trying to put together some elementary and rudimentary notes for some university students, who among them use both the TI-nspire CAS and the Casio ClassPad 330 (depends on what they were told to buy at school). This means I'm trying to become familiar with both. And occasionally I find something which is easier on one than the other. For example, suppose I have a square matrix A, and I want to create a square diagonal matrix D the same size as A, and with A's diagonal elements. (I don't think this forum supports math... so I can't show you what I mean.) On the TI-nspire, the command "D:=diag(diag(A))" does that. I can't find similar functionality on the ClassPad.

The other question: given a (non-singular) square matrix A and corresponding vector b, is there a command for solving the linear system Ax=b?

Thanks very much!

### #2 MicroPro

MicroPro

Casio Overlord

• Deputy
• 640 posts
• Gender:Male
• Location:Iran

• Calculators:

Posted 17 May 2013 - 05:53 PM

About your first question, it seems diag on nspire does more than one thing; it both extracts the diagonal elements and also makes a diagonal matrix out of a single-row one. On ClassPad this turned out to be a bit tricky though.

Create a program with A as its input argument. It can do the job:

```local A,M,s,i
rowDim(A) => s
fill(0,s,s) => M
For 1 => i To s
A[i,i] => M[i,i]
Next
Return M```
(Not tested on CP so I don't know if it suffers from CP's integer index bug or not)

For solving the systems while you already have the matrixes, make sure your b is a one-column matrix (if b is a list or a single-row matrix use listToMat and trn) then do augment(A, b) => C and then you can calculate C's reduced row echelon form using rref.
You can put these in a program and for example extract the last column as a list using e.g matToList(C, colDim( C ) ) to show beautiful messages to the user, etc. Hope this late answer helps.

### #3 AussieGuy

AussieGuy

Newbie

• Members
• 14 posts

• Calculators:

Posted 19 May 2013 - 10:23 PM

Thank you very much. I was hoping there might be some neat method of obtaining the diagonal matrix without having to write a program...but that looks like it will work.

One more question: is there an easy way of constructing a matrix whose elements are functions of the row and column indices; for example a[i,j] = i+j? Again, I can do this on the TI with "createMatrix", but on the CP 330 I don't seem to be able to do it without a program.

I don't mind writing programs myself, but I'm trying to ease the cognitive load on my students, many of whom have had no programming experience. So I'm looking for methods which just involve a few commands, rather than the creation of a program.

Thanks!

### #4 MicroPro

MicroPro

Casio Overlord

• Deputy
• 640 posts
• Gender:Male
• Location:Iran

• Calculators:

Posted 23 March 2014 - 11:49 AM

(As asked in PMs) About the integer index bug that I mentioned, it's NOT a bug that affects the result of calculations.

It has been discussed before but I don't remember where. It happens with certain functions, e.g if you have a list, then try to iterate over its elements using seq, the seq function thinks that its controlling variable x is not an integer therefore can't calculate A[‌x‌] and displays an error:

```{1,2,3,4,5} => A
seq(A[x], x, 1, 5, 1)
```

Using A[int(x)] or similar functions does NOT help.

I don't know if it still exists in the newest OS 3 version, or even it happens in For loops or not, but anyway it's a very frustrating error message if you ever see it!
• flyingfisch likes this

### Also tagged with one or more of these keywords: math, matrix, equations

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users