for matlab style

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

for matlab style

Message par compsystems » 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

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

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: for matlab style

Message par parisse » mer. janv. 30, 2019 12:08 pm

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.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: for matlab style

Message par compsystems » mer. janv. 30, 2019 5:42 pm

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

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: for matlab style

Message par parisse » jeu. janv. 31, 2019 6:08 pm

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.

Répondre