05-18-2018, 07:54 AM
This small code creates m×n anti-Identity matrix. It is for fx-9860 and similar calcs with matrix. For using with ClassPad the code has to be adapted which is very easy.
An enter is pressed at the end of row.
ClrText
"Dim"?->M:M->I:{M,M}->Dim Mat A/put here an output triangle - opt./
Fill(1,Mat A):Mat A/put here an output triangle- opt./
Do
0->Mat A [I, I]
I-1->I
LpWhile I>0
Mat A/put here an output triangle/
Description:
The Idea is simple- create square M×M zero matrix and replace values in the diagonal cells
1. Command "Dim" creates square M×M zero matrix
2. Command "Fill" replaces zero elements with 1
3. Command "Do" repeats the loop till the condition I>0
4. 0->Mat A [I, I] assigns 0 to all diagonal cells
5. Command "lpWhile" ends the loop when the condioit is achieved
---------------------------------------------
Variables:
M - dimension of Matrix
I - index of cell position (30, 29, 28)
[I.I] - index of diagonal cells
Mat A - created matrix A
---------------------------------------------
Notes: You can delete the first two triangles marked as opt., because I use them for visual checking of created matrix
Also You can add the "Det" command (Det Mat A) at the end of the program to calculate the determinant automatically
An enter is pressed at the end of row.
ClrText
"Dim"?->M:M->I:{M,M}->Dim Mat A/put here an output triangle - opt./
Fill(1,Mat A):Mat A/put here an output triangle- opt./
Do
0->Mat A [I, I]
I-1->I
LpWhile I>0
Mat A/put here an output triangle/
Description:
The Idea is simple- create square M×M zero matrix and replace values in the diagonal cells
1. Command "Dim" creates square M×M zero matrix
2. Command "Fill" replaces zero elements with 1
3. Command "Do" repeats the loop till the condition I>0
4. 0->Mat A [I, I] assigns 0 to all diagonal cells
5. Command "lpWhile" ends the loop when the condioit is achieved
---------------------------------------------
Variables:
M - dimension of Matrix
I - index of cell position (30, 29, 28)
[I.I] - index of diagonal cells
Mat A - created matrix A
---------------------------------------------
Notes: You can delete the first two triangles marked as opt., because I use them for visual checking of created matrix
Also You can add the "Det" command (Det Mat A) at the end of the program to calculate the determinant automatically