## 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

## How to define the smitform of a matrix over finit...

Suppose that A is an nxn matrix over the finite field Z:=GF(2,q) for some q. I wan to get the smitform of A over Z. First I used the package

with(LinearAlgebra[Generic])

and after that I applied the command

S := SmithForm[Z](A)

but the mentioned command made some errors. In fact, I do not how to define commands igcdex, iquo, irem, sign and abs for SmithForm over finite fields.

Thanks for any suggestions

## How to create recursive loops in procedure ...

Suppose that n is a positive integer number and [k1,k2,...,kn] is a list of non-negative integer numbers.

My Question: How to create the procedure proc([k1,k2,...,kn]) such that the output of this procedure is in the following form:

For i1 from 0 to k1 do

for i2 from 0 to k2 do

......................

for in from 0 to kn do

i1+i2+...+in

end do; end do;...end do;

## How do I interpret solutions which do not verify m...

Hello Everyone,

First of all I want to thank you to pay attention to my post.

For some reasons I want to know when does the root of my solution is equal to 0 isolating α, which yields the following equation

When I substitute 1/2 it verifies the equation, but when I substitute other solutions my equation is not verified. For instance substituting "α=-1/l" I get something different from 0 as you can see

My question is what are these "solutions" if they are not solutions ?
 I attach the file in case you would take a look at it Download Maple_question2.mw

## Pulling power into exponential under assumptions...

Hello,

Simple question:

Why does

restart;

(exp(I*t))^q;

assuming([simplify(%)], [t > 0, t < 2*Pi, q > 0, q < 1])

not simplify to exp(I*t*q)

?

## Data from a graph...

I draw a 3d graph and now i want the table of this graph. how can we get a table from the data of a plotted graph.

May grapg was obtained from the following commands

restart;
plot3d(1/2*(q^(2*n)-5.*q^n+(2.*q-1)^n+3), q = 2 .. 15, n = 2 .. 20);

## storing numbers in vector from a loop within a pr...

I am interested in taking a complex number and repeatedly raising it to a power and graphing the result to see if it looks cool (i think it will) to do this i wrote this program

iterativepower := proc (base, index, n)

local out, i;
out := vector(n+1, 1);

out[1] := base;

for i to n do out[i+1] := out[i]^index end do;

out;

end proc;

this can be run with:

iterativepower(2, 2, 5)

This doesn't return a vector, it returns the word out. Why is that, and how do i fix it?

## Cannot evaluate the solution past the initial poin...

Hi. Can anyone help me with this error, it says

Error, (in unknown) cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 >
 >
 >
 (4)
 >
 (5)
 >
 (6)
 >
 (7)
 >
 >
 (8)
 >
 shoot: Step #  1 shoot: Parameter values :  alpha = 3.0125 beta = -2.31 Psi = -0. Error, (in unknown) cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up
 >
 >
 >
 >
 >
 >
 >

## limit of multivariate function from different dire...

Hi,

I am having trouble with the syntax for entering a limit of a multivariate function with direction specifiers.

For a single variate function f(x) the limit for x -> a from the right is specified by

limit(f(x),x=a,right)

A limit of a multivariate function f(x,y) for x -> a and y -> b can be entered by

limit(f(x,y),{x=a,y=b})

However I do not know how to specify directions in this case. Say, I want x to approach a from the right, and y to approach b from the left. What is the syntax to do this?

Cheers!

## How do I plot a list as a function of another list...

I have two lists, A and B, with the same number of elements and I want A to be on the Y-axis and B on the X-axes and do a point plot

## Reduced Groebner Bases...

When I use the Groebner package I normally use it something like this:

with(Groebner):
F≔[x3−3xy,x2y−2y2+x]
Basis(F,plex(x,y))

Does this calculate a reduced Groebner basis or just a Groebner basis? The output looks reduced to me, and I'm sure that I've seen people treat it is as a reduced GB; but the help page doesn't confirm this. Interestingly i can't seem to find any other mention of reduced bases in the help documentation - which makes me think that this method does it (because otherwise people would want a seperate algorithm specifically for getting reduced GBs)

## Error, bad index into Array...

Hi,

I am trying to do a simple numerical calculation, and need to evaluate functions on a grid. I woult then like to build expression like finite differences, such as

Y[ i + 1 ] - Y[ i - 1 ]

where Y is my Array of function values. However I would then always get the "Error, bad index into Array", even though in the expressions I build i is specified as a summation index over a certain range. Interestingly, indexing with an i works though within the sequence command: seq( Y[ i ], i = 1..n) would produce an output.

I am not sure what is going on.

Thanks for Help!

## NLPSolve command: Warning, initial point ignored b...

EDIT

I could solve my problem already. I edit in the solution at the end, in case some one ever runs into the same issue, and is happy finding this post when searching for a solution.

/EDIT

Hi there!

I am starting to learn how to use the Optimization package. The help page for the NLPSolve command contains the example

NLPSolve(sin(x)/x, x=1..30)

which would spit out the local minumum at x=23.519… with value -0.042… .

I tried to use the initialpoint option in order to solve for other local minima or maxima, but regardless which initial point choose, I get

Warning, initial point option ignored by solver

and again the same local minimum as before. I entered the option as follows:

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17})

I am not sure why it doesn't work, since the NLPSolve help page contains an example using the initialpoint option right underneath this example, and there everything works as intended.

Does anyone know what is going on here?

Cheers!

EDIT

The problem was that NLPSolve uses the quadratic interpolation method by default if the function which should be extremised is univariate and unconstrained. This information can be found under the Optimization/General/Methods help page. This method however, is the only one which doesn't accept an initialpoint. Hence, the solution is to apply a different method, such as

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17},method=modifiednewton)

/EDIT

## Solve command doesn't find all solutions...

Hi there,

I am looking at the system of equations

with

Using the solve command with the assumption r >= 0 gives the solutions [r=0, theta=0], [r=1/2, theta=0] and [r=3/2, theta=pi].

However [r=0, theta=pi/2] is also a solution, which the solve command doesn't give me. Why not, and why doesn't if even give a warning that there are more solutions, which are not given?

Cheers!