xavier

132 Reputation

9 Badges

19 years, 78 days

MaplePrimes Activity


These are replies submitted by xavier

the versions multithread sudoku maplet are compatible with mapletviewer and the .exe in Maple 2021.

                                                               are only compatible with mapletviewer in Maple 2025

                 they are not compatible with maple 2015 due to the multithread functions.

The monothread sudoku maplet is compatible with mapletviewer and the .exe in Maple 2021

                                                    is only compatible with mapletviewer in Maple 2025

               it is also compatible with mapletviewer and .exe in Maple 2015.

My link on Application Center:

https://fr.maplesoft.com/Applications/Detail.aspx?id=155154

[123,432] for rand number

[1,1] number of grids 

(maximum number of empty boxes = 46)

works fine on Maple 2021 personal edition (Ubuntu 24.10 and Windows 11 famille) and gives me 2 grids :

for the english version of my sudoku maplet

go to the link :

https://maple.cloud/app/4921697492402176/sudokuvision_multithread3_version_anglaise?key=6D91F131982A4C48BEBC55D5DFF00A5692258B9905594E28BF08D0F9033A6065

Caution: For "random number" and "number of grids," sequences of integer must be inserted:

For random numbers "nombre aléatoire": example [1224521545,74544874587] the i th number in the sequence corresponds to the random number that initiates generation on the i th CPU thread.

For number of grids "nombre de grilles" : example [10,10] the i th number in the sequence corresponds to the number of sudoku grids to be generated by the ith CPU thread.
The number of terms in both sequences must be the same.

("seq pour multithread") means that a sequence of integers must be inserted. Each integer is processed by a CPU thread.
I could actually make an English version despite my lack of English!

In my sudoku maplet on Maple Cloud we can calculate sudoku grids with regions nxm on several threads of the cpu simultaneously.

We can also solve,import and export sudoku grids in .sdk,.csv,.txt and .sdm format and print sudoku games and their solution.

The entire worksheet is my unique own search (author:Xavier Cormier)

Go to the link in Maple Cloud :

https://maple.cloud/app/6283420531032064/sudoku+multithread3?key=8DBF1E6D71EF423B9BE883C27FF0FD892C14B4FCD25B4920A29AFE4E4B4363B8

my own searched algo for generalized sudoku

Sudoku Maplet (version 4) - Maple Application Center (maplesoft.com)

sudoku 15x15 generated with my maplet :

10 millions easy sudoku generated with my maplet :

10 millions de sudoku (kaggle.com)

I am on windows 10 with google chrome in France and I can't write a description for the app in the Application Center

how can I solve this problem ?

we can find all permutations :

findallperm4 := proc (l1, l2) local prodcartarr, d, zap, cnt, i, tx, R0, R; prodcartarr := proc (l) local A, t, B, i, k, m; A := [seq([l[1][j]],j = 1 .. nops(l[1]))]; for t to nops(l)-1 do B := []; for i to nops(A) do for k to nops(l[t+1]) do m := A[i]; if not member(l[t+1][k],A[i]) then m := [op(m), l[t+1][k]]; B := [op(B), m] end if end do end do; A := B end do; return A end proc; d := convert({op(l1)},list); zap := proc (x) procname(x) := 1; [] end proc; cnt := proc (i) zap(l1[i]) := [op(zap(l1[i])), i] end proc; for i to nops(l1) do cnt(i) end do; tx := table([seq(d[i] = zap(d[i]),i = 1 .. nops(d))]); R0 := [seq(tx[l2[k]],k = 1 .. nops(l2))]; zap := subsop(4 = NULL,eval(zap)); R := prodcartarr(R0); return R end proc;

findallperm4([b,b,c,a,a],[a,a,b,c,b]);
[[4, 5, 1, 3, 2], [4, 5, 2, 3, 1], [5, 4, 1, 3, 2], [5, 4, 2, 3, 1]]
 

we do the same thing with the initial problem:

trucall4 := proc (l0, l2) local prodcartarr, l1, d, zap, cnt, i, tx, s, R0, R, k; prodcartarr := proc (l) local A, t, B, i, k, m; A := [seq([l[1][j]],j = 1 .. nops(l[1]))]; for t to nops(l)-1 do B := []; for i to nops(A) do for k to nops(l[t+1]) do m := A[i]; if not member(l[t+1][k],A[i]) then m := [op(m), l[t+1][k]]; B := [op(B), m] end if end do end do; A := B end do; return A end proc; l1 := [seq(abs(evalf(l0[i])),i = 1 .. nops(l0))]; d := convert({op(l1)},list); zap := proc (x) procname(x) := 1; [] end proc; cnt := proc (i) zap(l1[i]) := [op(zap(l1[i])), i] end proc; for i to nops(l1) do cnt(i) end do; tx := table([seq(d[i] = zap(d[i]),i = 1 .. nops(d))]); s := sort(l1); R0 := [seq(tx[s[k]],k = 1 .. nops(s))]; zap := subsop(4 = NULL,eval(zap)); R := prodcartarr(R0); for k to nops(R) do print([seq(l0[R[k][i]],i = 1 .. nops(R[k]))]); print([seq(l2[R[k][i]],i = 1 .. nops(R[k]))]); print(`-----------`) end do end proc;

l1:=[3+I, I, 2, -1, 5, 4];l2:=[a, b, c, d, e, f];

trucall4(l1,l2);
[I, -1, 2, 3 + I, 4, 5]


[b, d, c, a, f, e]


-----------


[-1, I, 2, 3 + I, 4, 5]


[d, b, c, a, f, e]


-----------
 

 

findperm := proc (l1, l2) local transfo, L1, L2, t, R; transfo := proc (l) local l0, tx, k, ht, L1; l0 := convert({op(l)},list); tx := table([seq(l0[j] = j,j = 1 .. nops(l0))]); k := [seq(0,j = 1 .. nops(l0))]; ht := proc (i) local u; u := tx[l[i]]; k := [seq(k[v],v = 1 .. u-1), k[u]+1, seq(k[v],v = u+1 .. nops(k))]; return [l[i], k[u]] end proc; L1 := [seq(ht(i),i = 1 .. nops(l))]; return L1 end proc; L1 := transfo(l1); L2 := transfo(l2); t := table([seq(L1[i] = i,i = 1 .. nops(L1))]); R := [seq(t[L2[ki]],ki = 1 .. nops(L2))]; return R end proc;

 

I transforme with procedure "transfo" the list with repeated elements in a list of elements distincts:

ex: [b,b,c,a,a];

transfo([b,b,c,a,a]);
[[b, 1], [b, 2], [c, 1], [a, 1], [a, 2]]
 

for b:each time we have b in the list ,I count the number of apparitions (n) of b before its position (its position include). and I put [b,n].
 

findperm([b,b,c,a,a],[a,a,b,c,b]);
[4, 5, 1, 3, 2]
 

we can do something strange with my procedure:

the second list l2 can contain strictly the first list l1

findperm([b,b,d,a,a,d],[a,a,b,d,b]);
[4, 5, 1, 3, 2]
 

 we can use transfo for the initial problem:

truc := proc (l1, l2) local transfo, L2, L1, t, R, RE; transfo := proc (l) local l0, tx, k, ht, L1; l0 := convert({op(l)},list); tx := table([seq(l0[j] = j,j = 1 .. nops(l0))]); k := [seq(0,j = 1 .. nops(l0))]; ht := proc (i) local u; u := tx[l[i]]; k := [seq(k[v],v = 1 .. u-1), k[u]+1, seq(k[v],v = u+1 .. nops(k))]; return [l[i], k[u]] end proc; L1 := [seq(ht(i),i = 1 .. nops(l))]; return L1 end proc; L2 := transfo(sort([seq(evalf(abs(l1[io])),io = 1 .. nops(l1))])); L1 := transfo([seq(evalf(abs(l1[io])),io = 1 .. nops(l1))]); t := table([seq(L1[i] = i,i = 1 .. nops(L1))]); R := [seq(l1[t[L2[ki]]],ki = 1 .. nops(L2))]; RE := [seq(l2[t[L2[ki]]],ki = 1 .. nops(L2))]; print(R); print(RE) end proc;

with transfo we can use table.

l1:=[3+I, I, 2, -1, 5, 4];l2:=[a, b, c, d, e, f];

truc(l1,l2);
[I, -1, 2, 3 + I, 4, 5]


[b, d, c, a, f, e]
 

L1:=[3+I,I,2,-1,5,4];L2:=[a,b,c,d,e,f];
 

truc := proc (l0, bi) local pos, L, f, B; global A; A := []; pos := proc (a) local t; global ee; ee := 0; t := i -> if ee = 0 and l0[i] = a and not member(i,A) then A := [op(A), i]; ee := 1; return i end if; return op(map(t,[seq(io,io = 1 .. nops(l0))])) end proc; L := sort(l0); f := j -> if j <= nops(bi) then bi[j] end if; B := map(f,map(pos,L)); return B end proc;

truc([seq(evalf(abs(L1[i])),i=1..nops(L1))],L1);
[I, -1, 2, 3 + I, 4, 5]
 

truc([seq(evalf(abs(L1[i])),i=1..nops(L1))],L2);
[b, d, c, a, f, e]
 

 

 

 

The initial problem is activing a third time Maple 12 on vista.I have already contacted customer support (B.Vidalie) which said to me that it is impossible to do it with the student version of maple 12.

So,I installed my old version of maple:Maple 7 (the interface can work on vista except saving and reading .mws files (with the mouse) .I wonder if I could read my maple 12-Maplets and create it again on Maple 7.I have seen that "Maplets 1.0" which is a package for Maple 7 exists on the old mapleprimes and I wish to know if it  still exists on the web and if it is the case what is its address.

 

 

 

  

 

first you choose 5 boxes parmi 10 boxes :you have C(10,5)=10!/((5!)*(10-5)!)  possibilities and then you place your vowels in alphabetical order in your 5 boxes:you have one possibility. So you have C(10,5)*1 possibilities.

After that,for one of your C(10,5) possibilities,you complete the other boxes with the 5 other letters in order without repetitions :you have 5! possibilities.

So,totaly,you have C(10,5)*5! special arrangements possible cad: 30240 special arrangements of GELATINOUS. 

 

 

Thanks.

 

Sorry,I made a mistake in f :f doesn't work with a list of lists which have differents lengths. here is a new procedure f that seems working: f:=proc(l,k);if l=[] then l else if k=max(seq(nops(l[i]),i=1..nops(l)))+1 then l;else n:=min(seq(l[i][k],i=1..nops(l)));A:=[];B:=[];for ki from 1 to nops(l) do if l[ki][k]=n then A:=[op(A),l[ki]];else B:=[op(B),l[ki]];fi;od;AA:=[];AB:=[];for kk from 1 to nops(A) do if nops(A[kk])>=k+1 then AA:=[op(AA),A[kk]];else AB:=[op(AB),A[kk]];fi;od;return([op(AB),op(f(AA,k+1)),op(f(B,k))]);fi;fi;end; f([[2,1],[2,2],[2,1,3]],1); [[2, 1], [2, 1, 3], [2, 2]] f([[1,2,7,12],[3,4,5,6],[1,2,5,9]],1); [[1, 2, 5, 9], [1, 2, 7, 12], [3, 4, 5, 6]] (f is still a little complex but doesn't use 'sort')
I am working on Maple 7. I think I found a way to do what you want. It is the procedure f:you must put 1 for the second argument. f := proc (l, k) local n, A, B, ki, AA, d, kk, r, kki, BB; if l = [] then l else if k = max(seq(nops(l[i]),i = 1 .. nops(l)))+1 then l else n := min(seq(l[i][k],i = 1 .. nops(l))); A := []; B := []; for ki to nops(l) do if l[ki][k] = n then A := [op(A), l[ki]] else B := [op(B), l[ki]] end if end do; AA := []; d := sort(convert({seq(nops(A[i]),i = 1 .. nops(A))},list)); for kk to nops(d) do r := []; for kki to nops(A) do if nops(A[kki]) = d[kk] then r := [op(r), A[kki]] end if end do; AA := [op(AA), r] end do; BB := []; d := sort(convert({seq(nops(A[i]),i = 1 .. nops(A))},list)); for kk to nops(d) do r := []; for kki to nops(B) do if nops(B[kki]) = d[kk] then r := [op(r), B[kki]] end if end do; BB := [op(BB), r] end do; return [seq(op(f(AA[ti],k+1)),ti = 1 .. nops(AA)), seq(op(f(BB[ti],k)),ti = 1 .. nops(BB))] end if end if end proc; f([[1,2,7,12],[3,4,5,6],[1,2,5,9]],1); [[1, 2, 5, 9], [1, 2, 7, 12], [3, 4, 5, 6]]
1 2 Page 1 of 2