## 105 Reputation

12 years, 126 days

## How to write and specify a single value ...

Hi, here is what I have, I would like to get A[1],A[2],A[3]...A[20] which are 18x18 matrix.
Then I would like to specify certain value for example A[4](2,3), or A[5](1,8) etc.... But there seem to be something wrong with my definition of A[m], I could not write A[m](i,j).
When i type A[4], it does not give me a 18x18 matrix. Please help. Thanks.

with(LinearAlgebra):
interface(rtablesize=infinity):

lam:=RandomMatrix(18);

What changes should I make to make it sum up?

with(LinearAlgebra):
interface(rtablesize=infinity):

for k from 2 to 21 do
A[k]:=Matrix(18);
P[k]:=Matrix(18);
Ct[k]:=Matrix(18);
for i from 1 to (k-1) do
Ct[k]:=A[k-i].P[i];    ####what changes to make here?
end do:
end do:

I would like to get
Ct[2]=A[1].P[1]
Ct[3]=A[2].P[1]+A[1].P[2]
Ct[4]=A[3].P[1]+A[2].P[2]+A[1].P[3]
.....
Ct[21]=A[20].P[1...

## How to use this sequence...

Hi, here is what I have. How do I assign the each A please?

with(LinearAlgebra):
interface(rtablesize=infinity):

A:=seq(Matrix(18),i=1..21):
A[1]:=IdentityMatrix(18):

It wouldn't allow me to assign A[1]. May I know how do I do it please?

Thanks

## How to use proc...

Case 1:

ReturnInteger:=proc(x,y,z)::integer;
g:=3+y;
x^2-g;
end proc:

ReturnInteger(3,2,4)

Case 2: How do I have a few outputs at a time?

Outp:=proc(x,y,z)::integer;
x^4+3
x+3*y;
y+z;
end proc:

Outp(3,4,2)

I am looking for it to produce 3 answers.

Question 3, when i took away the "::integer", it still works. May I know...

## Changing each individual matrix in a loo...

Hi, I am trying to the following. When my DizLambda value is 0, I would like it to show "a" and if it is not 0 but smaller than 1.5 to show "9", otherwiese, it it is not 0 and bigger than 1.5, to show its original value. How do I do that please in its own matrix position?

restart:
with(LinearAlgebra):
interface(rtablesize=infinity):
node:=9:
Lambda:=DiagonalMatrix([3,6,4,2,5,2,3,5,3,7,4,7,4,6,8,9,2,1]):
dizLambda:=Matrix(node*2):
for i from 1 to (node*2-1) do

 First 6 7 8 9 10 11 12 Last Page 8 of 17
﻿