Post Reply 
Problem with a list in CAS-program
10-11-2017, 11:46 AM (This post was last modified: 10-11-2017 11:54 AM by toml_12953.)
Post: #2
RE: Problem with a list in CAS-program
(10-11-2017 09:45 AM)Arno K Wrote:  Is something like l(K):=l(K)+1 forbidden in a CAS-program? The list seems to be killed when the program runs through this order:
Code:
#cas
POSDIVNF(n):=
BEGIN
LOCAL l,p,j,m;
l:= MAKELIST(1,X,1,n);
PRINT();
 FOR j FROM 2 TO n DO
  p:=1;
m:=j;
   WHILE p≤j DO
     p:=nextprime(p);
      WHILE irem(m,p)==0 DO
      m:=iquo(m,p);
K:=p;//only inserted K as I had to break down the error by hand, lack of debug
PRINT(K);
PRINT(SIZE(l));
l(K):=l(K)+1;
//PRINT(l);
      END;
   END;
 END;

  return ΠLIST(l1);
END;
#end
the same code runs fine as program for home, the cas-program prints 2,8,3,3...
, notice the size of l: first 8 then 3, and returns: K->"Error:Invalid Dimension"
Arno

I copied and pasted your code into a virtual calc on a PC and it works fine except it returns l1 since l1 isn't defined anywhere.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Problem with a list in CAS-program - toml_12953 - 10-11-2017 11:46 AM
Problem with a list in CAS-program - Rudi - 10-29-2017, 04:55 PM



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