Recursive programs in XCAS.
|
02-12-2017, 02:08 AM
Post: #3
|
|||
|
|||
RE: Recursive programs in XCAS.
(02-12-2017 01:41 AM)Han Wrote: Can you provide a bit more information on what you have tried? Perhaps a snippet of code might provide a better idea of what you are trying to achieve. Or even a better description of what you wan to do beyond a generic description of "recursive program." Actually, I am trying to port the program, that you provided some time ago for HP Prime, to the PocketCAS on my iPhone 6+. On the HP Prime it works great, but on the iPhone 6+ I can't get it to work. Below I paste your original prgm. for the computation of the set of combinations from the set (list). EXPORT COMBOSET(s,n) BEGIN local l:={}; local sl:={}; local tl:={}; local i,j; local m:=size(s); case if n==m then l:={s}; end; if n==1 then l:=makelist({s(X)},X,1,m); end; if n>m then l:={}; end; for i from 2 to m-n+2 do sl:=sub(s,i,m); tl:=COMBOSET(sl,n-1); for j from 1 to size(tl) do tl(j):=concat({s(i-1)},tl(j)); end; l:=concat(l,tl); end; end; return(l); END; |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Recursive programs in XCAS. - John P - 02-12-2017, 12:22 AM
RE: Recursive programs in XCAS. - Han - 02-12-2017, 01:41 AM
RE: Recursive programs in XCAS. - John P - 02-12-2017 02:08 AM
RE: Recursive programs in XCAS. - John P - 02-12-2017, 02:32 AM
RE: Recursive programs in XCAS. - Han - 02-12-2017, 02:52 AM
RE: Recursive programs in XCAS. - Han - 02-12-2017, 04:06 AM
RE: Recursive programs in XCAS. - Han - 03-01-2017, 04:46 AM
RE: Recursive programs in XCAS. - Han - 03-01-2017, 04:49 AM
|
User(s) browsing this thread: 1 Guest(s)