## solution of RootOf...

Dear Helpers

I have a RootOf such as below. My question is how can I obtain a simple answer for it, or how can I simplify it? Also, what's the difference between the case "index=1" and the cases "index=2" and "index=3"?

" RootOf(6*_Z^3+(27+3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2))*_Z^2+(3*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^4*RootOf(_Z^2*l^2+3*_Z^4-3)^2-9*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^2+90*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2-18*l^4+6*l^6*RootOf(_Z^2*l^2+3*_Z^4-3)^2-81+45*RootOf(_Z^2*l^2+3*_Z^4-3)^2*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2))*_Z-324-3*l^8+l^10*RootOf(_Z^2*l^2+3*_Z^4-3)^2+108*RootOf(_Z^2*l^2+3*_Z^4-3)^2*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)-3*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^6+sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^8*RootOf(_Z^2*l^2+3*_Z^4-3)^2-63*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^2+30*sqrt(9-3*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2)*l^4*RootOf(_Z^2*l^2+3*_Z^4-3)^2+45*l^6*RootOf(_Z^2*l^2+3*_Z^4-3)^2+351*RootOf(_Z^2*l^2+3*_Z^4-3)^2*l^2-108*l^4, index = 1) "

Thank you so much!

## PDEs solve numerically...

Dear Users! I solved a PDE by using the following code.
restart;a := 1:b:= 2:l:= 1:alpha[1]:= 1:alpha[2]:= 3:
syspde:= [diff(u(x, t), t)-a+u(x, t)-u(x, t)^2*v(x, t)-alpha[1]*(diff(u(x, t), x$2)) = 0, diff(v(x, t), t)-b+u(x, t)^2*v(x, t)-alpha[2]*(diff(v(x, t), x$2)) = 0];
Bcs:= [u(x,0)=1,v(x,0)=1,D[1](u)(-l, t) = 0,D[1](u)(l, t) = 0,D[1](v)(-l, t) = 0,D[1](v)(l, t) = 0];
sol:=pdsolve(syspde, Bcs, numeric);
p1:=sol:-plot3d( u(x,t), t=0..1, x=-1..1, color=red);
p2:=sol:-plot3d( v(x,t), t=0..1, x=-1..1, color=blue);
Now I want to see the value of u(x, t)+diff(u(x, t), x)+diff(u(x, t), t) when x=0 and t=1. Please help me to fix the problem. Thanks in advance.

## fieldplot with a boundary...

Dear Guys

How can I plot a fieldplot with a boundary. For example I can plot

> fieldplot([y, -sin(x)-(1/10)*y], x = -1 .. 1, y = 0 .. 1);

but I want to see the field plot only in the region x^2+y^2<=1.

Thanks a lot

## Computation of all determinants of sub matrices of...

Let A be an nrxnr binary matrix. Suppose that the nxn binary matrix is obtained from the matrix A using the following code:

n := upperbound(A)[1]/r;
B := Matrix(n, n, 0);
for i to n do
for j to n do
B[i, j] := SubMatrix(A, [(i-1)*r+1 .. i*r], [(j-1)*r+1 .. j*r])
end do;
end do;

In other words, the matrix B is a decomposition of matrix A by rxr binary matrices. In the rest, we want to compute all determinants of the submatrices of B in module 2 as follows:

u := 1;
for k to n do
P := choose(n, k);
for i to nops(P) do
for j to nops(P) do
W := [];
for ii in P[i] do
for jj in P[j] do
W := [op(W), B[ii, jj]]
end do
end do;
x := mod(Det(convert(blockmatrix(k, k, W), Matrix)), 2);
if x = 0 then
u := 0;
i := nops(P)+1;
j := nops(P)+1;
k := n+1
end if
end do
end do;
unassign('i, j, ii, jj, W, x, P')
end do


In the last step, we check that if the value of all sub determinants of B in module 2, are non zero, then we announce that the block matrix B is an MDS matrix

if u = 1 then print(MDS) else print(NoMDS) end if

Based on the above description I wrote the following procedure:

restart

with(LinearAlgebra);
with(linalg, blockmatrix);
with(combinat)

MDS:=proc(A::Matrix,r::integer)
local n,B,i,j,u,ii,jj,k,P,W,x;
n:=upperbound(A)[1]/r;
B:=Matrix(n,n,0);
for i to n do
for j to n do
B[i,j]:=LinearAlgebra:-SubMatrix(A,[(i - 1)*r+1..i*r],[(j - 1)*r+1..j*r])
end do
end do;
unassign('i,j');
u:=1;
for k to n do
P:=combinat:-choose(n,k);
for i to nops(P) do
for j to nops(P) do
W:=[];
for ii in P[i] do
for jj in P[j] do
W:=[op(W),B[ii,jj]]
end do
end do;
x:=mod(Det(convert(linalg:-blockmatrix(k,k,W),Matrix)),2);
if x=0 then
u:=0;
i:=nops(P)+1;
j:=nops(P)+1;
k:=n+1
end if
end do
end do;
unassign('i,j,ii,jj,W,x,P')
end do;
if u=1 then print(MDS) else print(NoMDS) end if
end proc

My problem is that if A is a 64x64 binary matrix and also r=8, then the procedure MDS(A,8) takes 453 seconds to run in my computer (Maple 15 on windows 7 32bit with 4G RAM).

Is it possible to optimize the procedure such that MDS(A,8) takes less than 1 minutes.

Thanks for any help

## Improved the Speed of a Procedure in Modulo Two...

Let A=[V1, V2 ,..., Vn ] be a list of binary vectors such that the length of Vi for i=1...n is the positive integer number m. For instance, in the following example we have n=6 and m=5.

A := [[1, 1, 1, 0, 0], [0, 1, 0, 1, 1], [1, 0, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 0], [0, 1, 1, 1, 1]]

Suppose that ej with j=1...m are vectors of size m such that all entries of ej 's are zero except the jth entry where is equal to 1. Now set S=[e1,e2,...,em]. For example by m=5 we get

S:=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]

First, we choose i,j in [1...m] such that i<>j and then we update S as follows S=[e1,e2,...,em,ei+ej mod 2]. For example, it follows from i=1 and j=2 that

S:=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [1, 1, 0, 0, 0]]

Now consider the kth entry of A which is called Ak. Then we check that what is the minimum number of entries of S so that the summation of these entries mod 2 is equal to Ak. For example, for  S=[e1,e2,...,em,e1+e2 mod 2] we get [2, 3, 4, 3, 2, 4] which means the minimum number of entries of the S that are required to be added in order to obtain A1 is 2 and so on. Therefore, for the given example we get

E:=[[1, 2, [2, 3, 4, 3, 2, 4], 18, 7.615773106],
[1, 3, [2, 3, 3, 3, 3, 4], 18, 7.483314774],
[1, 4, [3, 3, 3, 3, 2, 4], 18, 7.483314774],
[1, 5, [3, 3, 3, 3, 3, 4], 19, 7.810249676],
[2, 3, [2, 3, 4, 2, 3, 3], 17, 7.141428429],
[2, 4, [3, 2, 4, 2, 2, 3], 16, 6.782329983],
[2, 5, [3, 2, 4, 3, 3, 3], 18, 7.483314774],
[3, 4, [3, 3, 3, 2, 3, 3], 17, 7.],
[3, 5, [3, 3, 3, 3, 3, 3], 18, 7.348469229],
[4, 5, [3, 2, 3, 3, 3, 3], 17, 7.]];

For instance, the interpretation of [3, 5, [3, 3, 3, 3, 3, 3], 18, 7.348469229] is that if S be [e1,e2,e3,e4,e5,e3+e5 mod 2] then we get [3, 3, 3, 3, 3, 3] where 18 is the summation of [3, 3, 3, 3, 3, 3] and also the number 7.348469229 is obtained from the following command:

MatrixNorm(convert([3, 3, 3, 3, 3, 3], Matrix), Frobenius);

Now we choose Ek for k in [1..nops(E)] such that Ek[4] be minimum over all Ek[4]'s. For example we choose [2, 4, [3, 2, 4, 2, 2, 3], 16, 6.782329983] since 16 is minimum between Ek[4]'s.

There are two points: First one is that if we have Ei and Ej such that Ei[4]=Ej[4] then we choose Ei if  Ei[5]>Ej[5] . The second point is that if Ei[4]=Ej[4] and also Ei[5]=Ej[5] then we choose one of them such as the first one. Finally we update the set S from the first two entries of Ek that we have obtained. For instance, the updated S in our example is:

S=[e[1],e[2],e[3],e[4],e[5],S[E[6][1]]+S[E[6][2]] mod 2]=[e[1],e[2],e[3],e[4],e[5],e[2]+e[4] mod 2]

Now we repeat this procedure for the updated S until that in one of the entries of E such as Ek we get Ek[3]=[1,1,..,1].

I have written a procedure in Maple for the mentioned question. But my procedure takes long time to compute when I run it over a list such as A with parameters n=m=64.

I want to kindly request you please modify the following code or suggest another fast procedure for this question.


restart;

with(LinearAlgebra):
with(ListTools):
with(combinat):

BP := proc (A::list)
local n, m, r, S, U, tt, P, E, t, Q, Z, R, k, T, j, PP, i, QQ;
n := nops(A);
m := nops(A[1]);
r := [seq(0, i = 1 .. m)];
r[1] := 1;
S := [seq(Rotate(r, m-i+1), i = 1 .. m)];
unassign('r');
U := [];
tt := 1;
while 0 < tt do
P := choose(nops(S), 2);
E := [];
for t to nops(P) do
Q := P[t];
Z := [];
R := [S[], mod(S[Q[1]]+S[Q[2]], 2)];
for k to n do
T := A[k];
for j to nops(R) do
PP := choose(nops(R), j);
for i to nops(PP) do
QQ := PP[i]; r := mod(add(R[QQ[i]], i = 1 .. nops(QQ)), 2);
if Occurrences(0, r-T) = m then
Z := [op(Z), j];
i := nops(PP)+1;
j := nops(R)+1
end if;
end do;
unassign('i, QQ, r, PP'):
end do;
end do;
E := [op(E), [Q[], Z, add(Z[i], i = 1 .. nops(Z)), evalf(MatrixNorm(convert(Z, Matrix), Frobenius))]];
unassign('k, Z, Q, R'):
end do;
r := FindMinimalElement([seq(E[i][4], i = 1 .. nops(E))]);
R := [];
for i to nops(E) do
if E[i][4] = r then R := [op(R), E[i]] end if
end do;
T := [FindMaximalElement([seq(R[i][5], i = 1 .. nops(R))], position)];
S := [S[], mod(S[R[T[2]][1]]+S[R[T[2]][2]], 2)];
U := [op(U), [R[T[2]][1], R[T[2]][2]]];
if Occurrences(1, R[T[2]][3]) = n then tt := 0 end if;
unassign('r, i, R, T, E')
end do;
return U;
end proc:

A := [[1, 1, 1, 0, 0], [0, 1, 0, 1, 1], [1, 0, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 0], [0, 1, 1, 1, 1]];

BP(A);
[[2, 4], [3, 6], [5, 7], [1, 2], [1, 6], [3, 8], [3, 9], [8, 9]]


## Is there a way to solve numerically a system of in...

Hello everybody,

While i was trying to work on a physical math problem, a system of 4 integral equations is obtained. The right hand sides of these equations are known functions of r. The left hand sides contain double integrals with respect to lambda and t. i believe that an analytical determination of the 4 unknown functions f_1(t), f_2(t), f_3(t), and f_4(t) is far from being trivial, thus recourse to a numerical technique is necessary and indispensable.

i tried to express the unknown functions as series expansions in t and solve the resulting linear system of equations for the expansion coefficients, but unfortunately the coefficients are very large and the solution is strongly dependent on the number of coefficients. i was wondering whether someone here has some experience with such integral problems and is willing to assist and help. Any hint is highly appreciated.

i attach a Maple script including the equations.

Thank you,

>>>>>> Question.mw

## Optimization over Binary Polynomials...

Assume that x[i] with 1≤i≤n are binary numbers. Let I_[k] be a subset with k elements of the set {1,2,⋯,n}.

Now Consider the following binary linear functions

It is clear that to obtain f[j]'s we need to compute ∑k[j] XOR bitwise operator. But it is possible to get f[j]'s with less than ∑k[j] XOR.

Example: Let n=8 and m=7 and suppose that

It follows from (1) that we need to do 20 XOR bitwise operator to get f[j]'s with 1≤j≤7. But set

which results in  f[j]'s are computed with just 9 XOR.

It is useful to mention that the relation (1) can be represented by a 8x8 binary matrix in the form of M*X=F.

Question: Is it possible to implement a procedure in Maple such that by applying the procedure we get  f[j]'s with the minimum number of XOR bitwise operator.

One solution for this question is the "parr algorithm" that is given in the following paper

https://ieeexplore.ieee.org/document/613165

This edition is because of @Carl Love commnet.

The paar algorithm is provided in C++ in the following link

https://github.com/rub-hgi/shorter_linear_slps_for_mds_matrices/blob/master/paar.cpp

and is defined by

My problem is that I couldn't implement the paar algorithm in Maple.

Thanks for any help

## how do i make ( isentropic-process) ?...

what is the wrong in this operations for isentropic process ( isentropic-process)

Restart: with(RealDomain) : interface(dispalyprecision=4) : ; Isentropical := proc(N,v) local K,PTR,KM1,KP1,GO, M,MS,C,PPT,TTT,RRT,AAS,eq,o ; K : = G() : KM1 : = k - 1 : KP1 : = K + 1 : GO := 1 : If N=1 then M := v Elif N=2 then PPT := v : M := sqrt ( 2 * (PPT^(-KM/K) -1 ) : Elif N=3 then MS := v : M := sqrt ( 1 / (KP1/ (2*MS^2) –KM1/2 ) : Elif N=4 then C := v : M := sqrt ( 2 / (KM1* (1 /(C^2) -1 )) ) : Elif N=5 then TTT := v : M := sqrt ( 2 * (1/TTT-1 ) / KM1 : Elif N=6 then RRT := v : M := sqrt ( 2 * (1/RRT^KM1 -1 ) / KM1 : Elif N=7 then AAS := v : eq :=AAS- (2*(1+KM1*M^2/2)/ KP1) ^ (KP1/ (2*KM1)) /M : M := fsolve(eq,M,0..1) : GO :=2 : Elif N=8 then AAS := v : eq :=AAS- (2*(1+KM1*M^2/2)/ KP1) ^ (KP1/ (2*KM1)) /M : M := fsolve(eq,M,1..infinity) : GO :=2 : Fi:fi GO<>2 then ASS := (2 *(1+ KM1*M^2/2/KP1) ^ (KP1/ (2*KM1)) /M fi: PTR := (1+ KM1*M^2/2/KP1) : PPT := PTR^(-K/KM1) : TTT:=PTR^ (-1) : RRT:+PTR^(-1/KM1) : If N <> 3 then MS := sqrt ( KP1 / ( 2 / ( M^2)+KM1) ) If N <> 3 then C := sqrt( 1 / (2 / (KM1*M^2) + 1 ) ) O := evalf([m,1./PPT,MS,C,1./TTT,1./RRT,AAS]) end : irp := proc (N, v) local f; f:=Isentropic1(N,v) : printf(cat(% 9.4f $7,  \ n) , f[ii$ii=1..7]) end : G := ( ) -> 1.4 : For mi form .1 to .5 do irp(1.mi) od : > > > Eq := table( [ (M2) = M2 , (MS2) = (K+1) /2 (2 / ( M2)+ (K-1) ) (C2) = 1 / (2 / (K-1)*M2+1 ) (PP0) = (1+(K-1)*M2/2)^(-K/(K-1) ) (RR0) = (1+(K-1)*M2/2)^(-1/(K-1) ) (TT0) = (1+(K-1)*M2/2)^(-1) (AAS) = (2 *(1 +(K-1)*M2/2 ) / (K+1) )^( (k-1) /(2*(k-1)))/ squt(M2) ]) : if vL=M then M2v := solve ( M2 -Eq[M2 ] , M2 ) : M2v := eval(M2v ,M2 = VR^2 ) : elif vL=MS then M2v := solve( M2 -Eq[MS2 ] , M2 ) : M2v := eval(M2v ,MS2 = VR^2 ) : elif vL=C then M2v := solve( M2 -Eq[C2 ] , M2 ) : M2v := eval(M2v ,C2 = VR^2 ) : elif vL=PP0 then M2v := solve( M2 -Eq[PP0] , M2 ) : M2v := eval(M2v ,PP0 = VR ) : elif vL=RR0 then M2v := solve( M2 -Eq[RR0] , M2 ) : M2v := eval(M2v ,RR0 = VR ) : elif vL=TT0 then M2v := solve( M2 -Eq[TT0] , M2 ) : M2v := eval(M2v ,TT0 = VR ) : elif vL=AASsub then M2v := fsolve( M2 -Eq[AAS] , M2 ) : M2 :=0..1 : elif vL=AASup then M2v := fsolve( M2 -Eq[AAS] , M2 ) : M2 :=1..infinity : fi: Eqsva1 := eva1(Eq, M2 = M2v) : Eqava1 [M] := sqrt(EqsVa1[M2] ) : Eqsva1[MS] := sqrt(EqsVa1[MS2] ) : Eqava1 [C] := sqrt(EqsVa1[C2] ) : 1var := [M, MS, C, PP0, RR0, TT0, AAS] : [seq(1var[i]=EqsVA1[1var[i] ] , I=1…nope(1var))] end: Egs :=[M=0.5, MS=0.53452, C=0.2182, P0P=0.84302, RR0=0.88517, TT0=0.95238, AASsub=1.33985, AASsup=0.95238] : For i from 1 to nops(Egs) do print(I,Isentropic2(Egs[i])) od : (process)

## How to transform a permutation into numbers and vi...

Dear all,

I hope everyone helps me about the problem of converting a permutation into numbers and vice versa on maple

Let Sn denote the set of all permutations of the set {0, 1, ..., n − 1}

Lehmer code is a bijective function l : Sn ->{0, 1, 2, ..., n! − 1}.

Define function l(S)=Sum(ci x (n − 1 − i)! ) where S in Sn and ci is the number of elements of the set { j > i | sj < si }

Inverse Lehmer code is a bijective function l−1 : {0, 1, 2, ..., n! − 1} -> Sn

For example: n=4 -->{0, 1, 2, 3}, for S = (0, 2, 1, 3) , so c0 = 0, c1 = 1 ( j=2 > i=1 and sj = 1 < si = 2), c2 = 0, c3 = 0 -->

I(S) = 0 x (3-0)! + 1 x (3 - 1)! + 0 x (3-2)! + 0 x (3 - 3)! = 2! = 2. So I((0, 2, 1, 3)) =2  and I-1(2) = (0, 2, 1, 3).

## Plot error (unable to evaluate the function to num...

I have not touched Maple in about 10 years and I'm back but apparently my Maple skills got quite a bit it rusty. I'm trying to plot a function but keep getting this warning and a blank graph:

"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"

Here is what I'm trying to do (put and call formulas for Black 76 model):

> with(Statistics);
> X := RandomVariable(Normal(0, 1));
> K := 150;
> r := 0.25e-1;
> s := .75;
> t := .5;
> d1 := f-> (log(f/K)+.5*s^2*t)/(s*sqrt(t)):

> d2 := f-> d1(f)-s*sqrt(t):
> c := f-> exp(-r*t)*(f*([CDF])(X, d1(f))-K*([CDF])(X, d2(f))) :
p := ->exp(-r*t)*(K*([CDF])(X, -d2(f))-f*([CDF])(X, -d1(f))):

All of the above work as intented:
> evalf(c(100)), evalf(p(100));

return the correct values. But I can't plot c( ) or p( ):

plot(c(f), f = 50 .. 100)

"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"

What am I doing wrong here? I will appreciate any help.

Thank you.

## how to ODEPLOT with respect to parameter?...

Hi, i want to plot an ode plot with respect to a parameter (E) in range [0,4] instead of time.
I start with unassign variable E and tried to change 't' for 'E' directly, but its give me error
did I use the incorrect syntax/ step?

restart; with(linalg); with(VectorCalculus); with(DEtools); with(plots)

r := .9; K := 10; beta := .5; g := 0.3e-1; alpha[1] := .4; alpha[2] := 2.2; alpha[3] := 4; d[1] := .1; d[2] := .1; q := 1; E := 2.5; s := .46; delta := 1.5; b := 1.2; p := 1; c := 0.1e-1; mu := 0.25e-1; P0 := 4; M0 := 5; N0 := 3; L0 := 2; T := 20

> dP := VectorCalculus[+](VectorCalculus[+](VectorCalculus[*](VectorCalculus[*](r, P(t)), VectorCalculus[+](1, VectorCalculus[-](VectorCalculus[*](P(t), 1/K)))), VectorCalculus[*](g, P(t))), VectorCalculus[-](VectorCalculus[*](beta, P(t)))); dM := VectorCalculus[+](VectorCalculus[+](VectorCalculus[*](beta, P(t)), VectorCalculus[-](VectorCalculus[*](VectorCalculus[*](q, E), M(t)))), VectorCalculus[-](VectorCalculus[*](d[1], M(t)))); dN := VectorCalculus[+](VectorCalculus[-](VectorCalculus[*](s, N(t))), VectorCalculus[*](VectorCalculus[*](VectorCalculus[*](delta, N(t)), M(t)), 1/VectorCalculus[+](M(t), VectorCalculus[*](b, N(t))))); dL := VectorCalculus[+](VectorCalculus[*](VectorCalculus[+](alpha[1], VectorCalculus[-](VectorCalculus[*](VectorCalculus[*](alpha[2], L(t)), 1/VectorCalculus[+](alpha[3], M(t))))), L(t)), VectorCalculus[-](VectorCalculus[*](d[2], L(t))));

> satu := diff(P(t), t) = dP; dua := diff(M(t), t) = dM; tiga := diff(N(t), t) = dN; empat := diff(L(t), t) = dL;

> pdb := satu, dua, tiga, empat; fcns := {L(t), M(t), N(t), P(t)};
> Q := dsolve({pdb, L(0) = L0, M(0) = M0, N(0) = N0, P(0) = P0}, fcns, type = numeric, method = rkf45, maxfun = 500000);
> odeplot(Q, [[t, P(t), color = blue], [t, M(t), color = green], [t, N(t), color = red], [t, L(t), color = gold]], t = 0 .. T, numpoints = 100000, thickness = 2);


its work fine if i plot with respect to time (t), but when i tried to change it for a parameter like E its doesnt work

unassign('E');
odeplot(Q, [[E, P(t), color = blue]], E = 0 .. 4, numpoints = 100000, thickness = 2)

Error, (in plots/odeplot) curve is not fully specified in terms of the ODE solution, found additional unknowns {E}
following the output that I expected

attached: captive_breeding.mw

## To Obtain the Column Rank of a Matrix Over Finite ...

Consider the finite field G:=GF(p,k) for some prime p and a positive integer k. Let H be an nxm matrix over G.

My question: How to obtain the minimum number of linearly dependent columns of the H over G.

## how to find charactersticks for the pde...

How to find characterstics for the PDE  yzp+2xq=xy  using maple.....plz help me

## Generating a Random Permutation in Maple 15...

I want to write a procedure P such that the input of P is a positive integer number n and the output of P is a random permutation of the numbers {1,2,..,n}.

I know that there is a command in Maple 2017 such that the command produces the mentioned request (random permutation in the combinatoric package), but I should work with Maple 15 and there is no the random permutation command in Maple 15.

One of the solutions that I am used is based on the random number and check that if the produced numbers are pairwise distinct or not. The problem of this method  is that for n>128, it takes too time to generate a random permutation of the length n.

Thanks for any suggestions.

## How to get an nxn binary matrix with some limitati...

Let A=(a_{i,j}) be an nxn non-singular matrix over GF(2). Assume that we have a positive integer number s and an irreducible polynomial f of degree n over GF(2).

My question: How to get nxn binary matrices such as A provided that the characteristic polynomial  of these matrices over GF(2) is f and also sum(a_{i,j}) is equal to s with 1<=i<=n and 1<=j<=n.

For example, consider n=8 and s=10 and f= x^8+x^7+x^5+x+1. Then I applied the following Maple code to generate the mentioned matrices.

restart
with(LinearAlgebra):

randomize();
roll := rand(1 .. 64);
roll1 := rand(1 .. 8);
roll2 := rand(9 .. 16);
roll3 := rand(17 .. 24);
roll4 := rand(25 .. 32);
roll5 := rand(33 .. 40);
roll6 := rand(41 .. 48);
roll7 := rand(49 .. 56);
roll8 := rand(57 .. 64);

u := 1; while u > 0 do
L := [roll(), roll1(), roll2(), roll3(), roll4(), roll5(), roll6(), roll7(), roll8(), roll()];
if nops({L[]}) = 10 then
A := Matrix(8, 8, 0); s := 0;
for i to 8 do
for j to 8 do
s := (i-1)*8+j;
if evalb(in(s, L)) then A[i, j] := 1 end if
end do; end do;
if Determinant(A) <> 0 then
if evalb(in(sort(mod(Factor(CharacteristicPolynomial(A, x)), 2))[x^8+x^7+x^5+x+1]))
then print(A, sort(mod(Factor(CharacteristicPolynomial(A, x)), 2)));
u := 0 end if; end if;
unassign('A, s, i, j')
end if; end do;
unassign('u, i')

with my computer, it takes less than one minute to generate an 8x8 desired non-singular binary matrix as follows

\left[
\begin {array}{cccccccc}
0&0&1&0&0&0&0&0\\
0&1&1&0&0&0&0&0\\
0&0&0&1&0&0&0&0\\
0&1&0&0&0&0&1&0\\
1&0&0&0&0&0&0&0\\
0&0&0&0&1&0&0&0\\
0&0&0&0&0&0&0&1\\
0&0&0&0&0&1&0&0
\end {array}
\right]

I wish I could find a systematic method to find these kind of matrices.

Thanks for any suggestions

 1 2 3 4 5 6 7 Last Page 2 of 47
﻿