for matlab style
Publié : mar. janv. 29, 2019 6:59 pm
Hello BP
In matlab, the largest object constructor is an array, and of the matrix type. The FOR cycle uses a sequence as a control argument, please can replicate this feature in GIAC
MatLab Code
xcas code
xcas matlab style (for)
In matlab, the largest object constructor is an array, and of the matrix type. The FOR cycle uses a sequence as a control argument, please can replicate this feature in GIAC
MatLab Code
Code : Tout sélectionner
s = 3;
H = zeros(s);
for c = 1:s
for r = 1:s
H(r,c) = 1/(r+c-1);
end
end
Code : Tout sélectionner
hilb( s ):={
local h, c, r;
h := makemat(0,s,s);
for c from 1 to s do
for r from 1 to s do
h[[r,c]] := 1/(r+c-1);
end;
end;
return h;
}
Code : Tout sélectionner
hilb( s ):={
local h, c, r;
h := makemat(0,s,s);
for c: 1..s do
for r: 1..s do
h[[r,c]] := 1/(r+c-1);
end;
end;
return h;
}