Page 1 sur 1

for matlab style

Publié : mar. janv. 29, 2019 6:59 pm
par compsystems
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

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
xcas code

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;
}
xcas matlab style (for)

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;
}

Re: for matlab style

Publié : mer. janv. 30, 2019 12:08 pm
par parisse
As already explained, I can not support all styles. Each time I add something in the parser, the probability to break something else increases. I don't plan to support matlab because matlab users have no reason to run xcas.

Re: for matlab style

Publié : mer. janv. 30, 2019 5:42 pm
par compsystems
hello BP,

The idea is not that users can run GIAC from matlab, but follow something of the matlab style, since matlab is thought of as manipulation of matrices and vectors, and one of these thoughts is to introduce the range of values of the FOR cycle as a vector It is more explicit.

so as not to affect the users of GIAC/Xcas, I think that a Beta version should be maintained, different to the stable version or not stable

Re: for matlab style

Publié : jeu. janv. 31, 2019 6:08 pm
par parisse
It's not a question of a beta vs a stable version, it's that I do not want to break something and then have to fix a cascade of bugs. I did that for Python and it was more than one year work. Now I want to program things that are more interesting.