MaplePrimes Questions

I tried three commands for uniform random distribution. The memory used by sequence created by Generate(distribution(Uniform(0, 1))) is very high. But this is the command which can bring randomness while doing metropolis algorithm. The other two commands consume very less memory but cannot bring randomness. I need the one which can inject randomness and at the same time uses less memory. Thank you. 

 

DISTRIBUTION.mw

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 

restart;
l := -2;
                               -2
m := 1;
                               1
k := sqrt(-1/(6*beta))/l;
                                    (1/2)
                         1  /   6  \     
                       - -- |- ----|     
                         12 \  beta/     
w := (1/5)*alpha/(beta*l);
                              alpha 
                           - -------
                             10 beta
a[2] := -12*sqrt(-1/(6*beta))*alpha*m^2/(5*l*l);
                                 (1/2)      
                      1  /   6  \           
                    - -- |- ----|      alpha
                      10 \  beta/           
a[0] := 0;
                               0
a[1] := 0;
                               0
F := -l*C[1]/(m*(C[1]+cosh(l*(xi+xi[0]))-sinh(l*(xi+xi[0]))));
                             2 C[1]                      
       --------------------------------------------------
       C[1] + cosh(2 xi + 2 xi[0]) + sinh(2 xi + 2 xi[0])
beta := -2;
                               -2
alpha := 3;
                               3
C[1] := -1/1000;
                               -1 
                              ----
                              1000
xi[0] := 1;
                               1
xi := k*x-t*w;
                        1   (1/2)     3   
                      - -- 3      x - -- t
                        12            20  

u := a[0]+a[1]*F+a[2]*F*F;
   /   (1/2)\//        /   1  
 - \3 3     / |2500000 |- ----
              \        \  1000

          /1  (1/2)     3        /  1   (1/2)     3   \   \
    + cosh|- 3      x + -- t - 2 |- -- 3      x - -- t|[0]|
          \6            10       \  12            20  /   /

          /1  (1/2)     3        /  1   (1/2)     3   \   \\  \
    - sinh|- 3      x + -- t - 2 |- -- 3      x - -- t|[0]||^2|
          \6            10       \  12            20  /   //  /


plot3d(u, x = -3 .. 3, t = -3 .. 3);
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
 

I hope you can help me. I like to use the Workbook feature in Maple 2018. I save variables in one document to use them in another document as well. If, however, the value of the variable changes, I have to delete the variable in the variable manager each time and save it again.
Is there a command I can use to delete and re-save the saved variables?

I've been trying to make Julia sets using maple for a project im working on, but the maple help function tells me to embed the image, which does not give me the Plot options or the option to zoom in for a more detailed view.  I have tried using several different image tools, and the only one that seems to output it as a plot is Preview, but then when i zoom in it is in terrible detail and is very pixelated.  I think i just need to use a different output than Embed, but i can't find one that will work, can anyone help please?

Here is the code i've been using:

> with(Fractals:-EscapeTime);

> with(ImageTools);

> bl, ur, c := -2.0-1.5*I, 2.0+1.5*I, -.92+.25*I;

> M := Julia(500, bl, ur, c);

> Embed(M);
 

Thanks

For example, A with a B weighting?

Thanks

QuestionHistogramme.mw

Hi All,

I have been using trignometric functions where the inputs are sometimes intergers. When ever I am having an interger as argument for trignometric functions the out is unevaluated.

expression := 3*sin(z)+9*sin(x)*(1/4);
values := [x = 1, z = 1.570796327];

Now if I evaluate the above expression
eval(expression, values);
output is something like below
3.+9*sin(1)*(1/4)

 

but if I change the x value from 1 to 1.0

expression := 3*sin(z)+9*sin(x)*(1/4); values := [x = 1.0, z = 1.570796327];
My output is 4.893309716;

I am doing ths inside a procedure hence I cannot change the values to float manually, Is it possible to change the intergers to floats when using trig functions??

Thank you

I have written a procedure in which the content is written as either for loop or add commands. Since this procedure need to be evaluated around 1-1.5 lakhs times during iteration (running an iterative method) I need to know which of the two procedure will consume less memory. The whole calculation takes 4 gb. So i am trying to optimize the code. Thank you.

 

procedure_new.mw

Hey,

I have just started using Maple for my university project and I am follwing this guide https://www.maplesoft.com/support/help/maple/view.aspx?path=DifferentialGeometry%2FTensor%2FKillingVectors to calculate Killing Vectors. My issue is that when I try and define a metric using evalDG, I need to write dx&tdx to mean the tensor product between the two. Maple interperates this as a neutral operator and gives me "Error, invalid neutral operator".

I am not sure where the issue is as I have written exactly the same code as the guide and yet it gives me an error 3 lines in. Is there some issue that I am not aware of as someone who hasn't used Maple before? Any advice would be useful as I am not really sure how it is possible and I need to be able to write the tensor product to define the metric. 

 

Even for the simplest metric it does not work. My code is:

with(DifferentialGeometry): with(Tensor): with(LieAlgebras):
DGsetup([x, y], M):
g1:=evalDG( dx&tdx):
 

Any help would be greatly appreciated.

 

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 I can find solutions for non linear equations.

I want to find non zero solution.

thank you

ZAH.mw



Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/ZAH.mw .
 

Download ZAH.mw

I get this problem in a paper published in 2011. there is a table which compares the solution of a differential equation and gives the range of initial guesses. I got confused when saw maple and approximated maple, please any help me 

I'm attaching the link of paper. Please have a look at table 3. 

https://www.sciencedirect.com/science/article/pii/S0098135411000056

Hi, Maple is totally new to me and I found something confusing.

Here is what I have:

the_first_element:= proc( A:: Array( numeric ) ) ;
A[1];
end proc():

And it shows Error, invalid input: unknown uses a 1st argument, A (of type Array(numeric)), which is missing.

 

But in another similar procedure, I have exactly the same lines but it goes without error. 

locate_max := proc( A :: Array( numeric ) )
if ArrayNumDims(A) <> 1 then
    error "can only search 1d arrays"
  end if:
end proc: 

I have no idea what is wrong with these 4 lines.

Thank you in advance!

If I add "restart" to a program, then interface(imaginaryunit=j) don't work. Why? 

***********************************
restart;
interface(imaginaryunit = j);
j^2;
************************************
The output is j^2  but the output should be -1. 

 

Dear all,
How can I input different spacesteps in numerical solution of PDE (Heat equation) with pdsolve of Maple?

For example, the x range is x=0..L,
and I'd like to solve the PDE with spacestep1=L/100 for x=0..a and spacestep2=L/10 for x=a..L.

Thank you in advance!

First 734 735 736 737 738 739 740 Last Page 736 of 2434