Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

restart;
solve({12 beta k^2 w alpha[2]+k alpha[2]^2, 56 beta k^2 m w alpha[2]+4 beta k^2 w alpha[1]-4 A k^2 alpha[2]+8 k m alpha[2]^2+2 k alpha[1] alpha[2]0, 104 beta k^2 m^2 w alpha[2]+16 K beta k^2 w alpha[2]+16 beta k^2 m w alpha[1]-20 A k^2 m alpha[2]+28 k m^2 alpha[2]^2-2 A k^2 alpha[1]+14 k m alpha[1] alpha[2]+2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2], 56 k alpha[2]^2 m^3+42 k alpha[1] alpha[2] m^2+6 m (2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2])+96 w k^2 beta alpha[2] m^3+40 w k^2 beta alpha[2] K m-40 A k^2 alpha[2] m^2-4 A K k^2 alpha[2]+2 k alpha[0] alpha[1]+2 k alpha[2] beta[1]-2 w alpha[1]+4 w k^2 beta alpha[1] K+4 (8 K beta k^2 w alpha[2]-2 A k^2 alpha[1]) m+24 w k^2 beta alpha[1] m^2,70 k alpha[2]^2 m^4+70 k alpha[1] m^3 alpha[2]+15 m^2 (2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2])+5 (-4 A K k^2 alpha[2]+2 k alpha[0] alpha[1]+2 k alpha[2] beta[1]-2 w alpha[1]) m+80 w k^2 beta alpha[2] K m^2-40 A k^2 alpha[2] m^3+44 w k^2 beta alpha[2] m^4+4 w k^2 beta alpha[2] K^2-2 A k^2 alpha[1] K+k alpha[0]^2+2 k alpha[1] beta[1]+2 k alpha[2] beta[2]-2 w alpha[0]+16 w k^2 beta alpha[1] K m+6 (8 K beta k^2 w alpha[2]-2 A k^2 alpha[1]) m^2+16 w k^2 beta alpha[1] m^3-4 w k^2 beta beta[1] m+2 A k^2 beta[1]+4 w k^2 beta beta[2],56 k alpha[2]^2 m^5+70 k alpha[1] alpha[2] m^4+20 m^3 (2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2])+10 (-4 A K k^2 alpha[2]+2 k alpha[0] alpha[1]+2 k alpha[2] beta[1]-2 w alpha[1]) m^2+80 w k^2 beta alpha[2] K m^3-20 A k^2 alpha[2] m^4+8 w k^2 beta alpha[2] m^5+4 (4 K^2 beta k^2 w alpha[2]-2 A K k^2 alpha[1]+k alpha[0]^2+2 k alpha[1] beta[1]+2 k alpha[2] beta[2]-2 w alpha[0]) m+24 w k^2 beta alpha[1] K m^2+4 (8 K beta k^2 w alpha[2]-2 A k^2 alpha[1]) m^3+4 w k^2 beta alpha[1] m^4+2 k alpha[0] beta[1]+2 k alpha[1] beta[2]-2 w beta[1]-4 w k^2 beta beta[1] m^2+4 w k^2 beta beta[1] K+4 A k^2 beta[1] m-8 w k^2 beta beta[2] m+4 A k^2 beta[2],28 k alpha[2]^2 m^6+42 k alpha[1] alpha[2] m^5+15 m^4 (2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2])+10 (-4 A K k^2 alpha[2]+2 k alpha[0] alpha[1]+2 k alpha[2] beta[1]-2 w alpha[1]) m^3+40 w k^2 beta alpha[2] K m^4-4 A k^2 alpha[2] m^5+6 (4 K^2 beta k^2 w alpha[2]-2 A K k^2 alpha[1]+k alpha[0]^2+2 k alpha[1] beta[1]+2 k alpha[2] beta[2]-2 w alpha[0]) m^2+16 w k^2 beta alpha[1] K m^3+(8 K beta k^2 w alpha[2]-2 A k^2 alpha[1]) m^4+3 (2 k alpha[0] beta[1]+2 k alpha[1] beta[2]-2 w beta[1]) m-8 w k^2 beta beta[1] K m+2 A k^2 beta[1] m^2+2 A k^2 beta[1] K+2 k alpha[0] beta[2]+k beta[1]^2-2 w beta[2]+16 w k^2 beta beta[2] K+(8 K beta k^2 w beta[1]+4 A k^2 beta[2]) m,8 k alpha[2]^2 m^7+14 k alpha[1] alpha[2] m^6+6 m^5 (2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2])+5 (-4 A K k^2 alpha[2]+2 k alpha[0] alpha[1]+2 k alpha[2] beta[1]-2 w alpha[1]) m^4+8 w k^2 beta alpha[2] K m^5+4 (4 K^2 beta k^2 w alpha[2]-2 A K k^2 alpha[1]+k alpha[0]^2+2 k alpha[1] beta[1]+2 k alpha[2] beta[2]-2 w alpha[0]) m^3+4 w k^2 beta alpha[1] K m^4+3 (2 k alpha[0] beta[1]+2 k alpha[1] beta[2]-2 w beta[1]) m^2+2 (2 A K k^2 beta[1]+2 k alpha[0] beta[2]+k beta[1]^2-2 w beta[2]) m-4 w k^2 beta beta[1] K m^2+4 w k^2 beta beta[1] K^2-8 w k^2 beta beta[2] K m+4 A k^2 beta[2] K+2 k beta[1] beta[2],k m^8 alpha[2]^2+2 k m^7 alpha[1] alpha[2]+m^6 (2 k alpha[0] alpha[2]+k alpha[1]^2-2 w alpha[2])+(-4 A K k^2 alpha[2]+2 k alpha[0] alpha[1]+2 k alpha[2] beta[1]-2 w alpha[1]) m^5+(4 K^2 beta k^2 w alpha[2]-2 A K k^2 alpha[1]+k alpha[0]^2+2 k alpha[1] beta[1]+2 k alpha[2] beta[2]-2 w alpha[0]) m^4+(2 k alpha[0] beta[1]+2 k alpha[1] beta[2]-2 w beta[1]) m^3+(2 A K k^2 beta[1]+2 k alpha[0] beta[2]+k beta[1]^2-2 w beta[2]) m^2+(4 K^2 beta k^2 w beta[1]+4 A K k^2 beta[2]+2 k beta[1] beta[2]) m+12 w k^2 beta beta[2] K^2+k beta[2]^2},{k,w, alpha[0], alpha[1], beta[1], alpha[2], beta[2]});
Error, missing operation
 

I get trig expressions which are long but contain structure,  The simplest example might be the following which is nothing but a.b where a and b are two unit vectors in polar coordinates.

cos(`θa`)*cos(theta;b)+sin(`θa`)*cos(`φa`)*sin(theta;b)*cos(phi;b)
+sin(`θa`)*sin(`φa`)*sin(theta;b)*sin(phi;b)

 

Whereas the above is easy to identify, in general the structures are not evident.

Question 1  Is there a way to extract such vectors from long trig expressions? I am most interested in identifying inner, cross and outer products of unit vectors contained in these expressions.

Question 2 I would like to apply trig formulae, double angles etc, selectively.  That is apply the formula to only some of the quantities present, say only on the angles theta;a, and theta;b, but not on the phi's.  How is that done?

Thanks

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

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. 

 

First 717 718 719 720 721 722 723 Last Page 719 of 2218