Post Reply 
problem with CHS
03-01-2019, 05:26 PM (This post was last modified: 03-01-2019 05:28 PM by Tyann.)
Post: #5
RE: problem with CHS
J'ai je pense enfin résolu mon problème, plus d'erreur depuis plusieurs essais maintenant.
Voilà ce que j'ai cru comprendre :
Le problème venait apparement de l'initialisation de sx et sy qui était fait comme ceci:
soit 'n' le nombre d'éléments des 2 listes, le but étant d'avoir des valeurs -1 ou 1 au hasard.
Code:
LOCAL s,sx,sy;
s:=RANDINT(n,1,10);sx:=IFTE(s>5,1,-1); 
s:=RANDINT(n,1,10);sy:=IFTE(s>5,1,-1);
et que j'ai transformé en :
Code:
LOCAL i,s1,s2,sx:={},sy:={};
s1:=RANDINT(n,1,10);
s2:=RANDINT(n,1,10);
FOR i FROM 1 TO n DO
 sx(0):=IFTE(s1(i)>5,1,-1);
 sy(0):=IFTE(s2(i)>5,1,-1);
END;
J'avais pourtant testé la première méthode dans Home avant de le programmer et cela fonctionnait ?


I think I finally solved my problem, more error for several tries now.
This is what I understand:
The problem apparently came from the initialization of sx and sy which was done like this:
either 'n' the number of elements of the 2 lists, the goal being to have values ​​-1 or 1 at random.
Code:
LOCAL s,sx,sy;
s:=RANDINT(n,1,10);sx:=IFTE(s>5,1,-1); 
s:=RANDINT(n,1,10);sy:=IFTE(s>5,1,-1);
and that I turned into:
Code:
LOCAL i,s1,s2,sx:={},sy:={};
s1:=RANDINT(n,1,10);
s2:=RANDINT(n,1,10);
FOR i FROM 1 TO n DO
 sx(0):=IFTE(s1(i)>5,1,-1);
 sy(0):=IFTE(s2(i)>5,1,-1);
END;
But I had tested the first method in Home before programming it and it worked ?

Sorry for my english
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
problem with CHS - Tyann - 03-01-2019, 09:22 AM
RE: problem with CHS - StephenG1CMZ - 03-01-2019, 01:42 PM
RE: problem with CHS - rprosperi - 03-01-2019, 01:56 PM
RE: problem with CHS - Tyann - 03-01-2019, 02:44 PM
RE: problem with CHS - Tyann - 03-01-2019 05:26 PM
RE: problem with CHS - Albert Chan - 03-01-2019, 06:56 PM
RE: problem with CHS - Didier Lachieze - 03-01-2019, 09:49 PM
RE: problem with CHS - Tyann - 03-02-2019, 05:50 AM



User(s) browsing this thread: 1 Guest(s)