Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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. 

 

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!

Hi,

How to generate the whole table of quantiles for a normal reduced centered N(0,1)?

 

restart;
Chargement Statistics
X := RandomVariable(Normal(0, 1));
                            X := _R
Statistics[Quantile](X, 0.1e-1);
                       -2.32634787404074

 

 

 


A Complete Guide for performing Tensors computations using Physics

 

This is an old request, a complete guide for using Physics  to perform tensor computations. This guide, shown below with Sections closed, is linked at the end of this post as a pdf file with all the sections open, and also as a Maple worksheet that allows for reproducing its contents. Most of the computations shown are reproducible in Maple 2018.2.1, and a significant part also in previous releases, but to reproduce everything you need to have the Maplesoft Physics Updates version 283 or higher installed. Feedback one how to improve this presentation is welcome.

 

Physics  is a package developed by Maplesoft, an integral part of the Maple system. In addition to its commands for Quantum Mechanics, Classical Field Theory and General Relativity, Physics  includes 5 other subpackages, three of them also related to General Relativity: Tetrads , ThreePlusOne  and NumericalRelativity (work in progress), plus one to compute with Vectors  and another related to the Standard Model (this one too work in progress).

 

The presentation is organized as follows. Section I is complete regarding the functionality provided with the Physics package for computing with tensors  in Classical and Quantum Mechanics (so including Euclidean spaces), Electrodynamics and Special Relativity. The material of section I is also relevant in General Relativity, for which section II is all devoted to curved spacetimes. (The sub-section on the Newman-Penrose formalism needs to be filled with more material and a new section devoted to the EnergyMomentum tensor is appropriate. I will complete these two things as time permits.) Section III is about transformations of coordinates, relevant in general.

 

For an alphabetical list of the Physics commands with a brief one-line description and a link to the corresponding help page see Physics: Brief description of each command .

 

I. Spacetime and tensors in Physics

 

 

This section contains all what is necessary for working with tensors in Classical and Quantum Mechanics, Electrodynamics and Special Relativity. This material is also relevant for computing with tensors in General Relativity, for which there is a dedicated Section II. Curved spacetimes .

 

Default metric and signature, coordinate systems

   

Tensors, their definition, symmetries and operations

 

 

Physics comes with a set of predefined tensors, mainly the spacetime metric  g[mu, nu], the space metric  gamma[j, k], and all the standard tensors of  General Relativity. In addition, one of the strengths of Physics is that you can define tensors, in natural ways, by indicating a matrix or array with its components, or indicating any generic tensorial expression involving other tensors.

 

In Maple, tensor indices are letters, as when computing with paper and pencil, lowercase or upper case, latin or greek, entered using indexation, as in A[mu], and are displayed as subscripts as in A[mu]. Contravariant indices are entered preceding the letter with ~, as in A[`~&mu;`], and are displayed as superscripts as in A[`~mu`]. You can work with two or more kinds of indices at the same time, e.g., spacetime and space indices.

 

To input greek letters, you can spell them, as in mu for mu, or simpler: use the shortcuts for entering Greek characters . Right-click your input and choose Convert To → 2-D Math input to give to your input spelled tensorial expression a textbook high quality typesetting.

 

Not every indexed object or function is, however, automatically a tensor. You first need to define it as such using the Define  command. You can do that in two ways:

 

1. 

Passing the tensor being defined, say F[mu, nu], possibly indicating symmetries and/or antisymmetries for its indices.

2. 

Passing a tensorial equation where the left-hand side is the tensor being defined as in 1. and the right-hand side is a tensorial expression - or an Array or Matrix - such that the components of the tensor being defined are equal to the components of the tensorial expression.

 

After defining a tensor - say A[mu] or F[mu, nu]- you can perform the following operations on algebraic expressions involving them

 

• 

Automatic formatting of repeated indices, one covariant the other contravariant

• 

Automatic handling of collisions of repeated indices in products of tensors

• 

Simplify  products using Einstein's sum rule for repeated indices.

• 

SumOverRepeatedIndices  of the tensorial expression.

• 

Use TensorArray  to compute the expression's components

• 

TransformCoordinates .

 

If you define a tensor using a tensorial equation, in addition to the items above you can:

 

• 

Get each tensor component by indexing, say as in A[1] or A[`~1`]

• 

Get all the covariant and contravariant components by respectively using the shortcut notation A[] and "A[~]".

• 

Use any of the special indexing keywords valid for the pre-defined tensors of Physics; they are: definition, nonzero, and in the case of tensors of 2 indices also trace, and determinant.

• 

No need to specify the tensor dependency for differentiation purposes - it is inferred automatically from its definition.

• 

Redefine any particular tensor component using Library:-RedefineTensorComponent

• 

Minimizing the number of independent tensor components using Library:-MinimizeTensorComponent

• 

Compute the number of independent tensor components - relevant for tensors with several indices and different symmetries - using Library:-NumberOfTensorComponents .

 

The first two sections illustrate these two ways of defining a tensor and the features described. The next sections present the existing functionality of the Physics package to compute with tensors.

 

Defining a tensor passing the tensor itself

   

Defining a tensor passing a tensorial equation

   

Automatic formatting of repeated tensor indices and handling of their collisions in products

   

Tensor symmetries

   

Substituting tensors and tensor indices

   

Simplifying tensorial expressions

   

SumOverRepeatedIndices

   

Visualizing tensor components - Library:-TensorComponents and TensorArray

   

Modifying tensor components - Library:-RedefineTensorComponent

   

Enhancing the display of tensorial expressions involving tensor functions and derivatives using CompactDisplay

   

The LeviCivita tensor and KroneckerDelta

   

The 3D space metric and decomposing 4D tensors into their 3D space part and the rest

   

Total differentials, the d_[mu] and dAlembertian operators

   

Tensorial differential operators in algebraic expressions

   

Inert tensors

   

Functional differentiation of tensorial expressions with respect to tensor functions

   

The Pauli matrices and the spacetime Psigma[mu] 4-vector

   

The Dirac matrices and the spacetime Dgamma[mu] 4-vector

   

Quantum not-commutative operators using tensor notation

   

II. Curved spacetimes

 

 

Physics comes with a set of predefined tensors, mainly the spacetime metric  g[mu, nu], the space metric  gamma[j, k], and all the standard tensors of general relativity, respectively entered and displayed as: Einstein[mu,nu] = G[mu, nu],    Ricci[mu,nu]  = R[mu, nu], Riemann[alpha, beta, mu, nu]  = R[alpha, beta, mu, nu], Weyl[alpha, beta, mu, nu],  = C[alpha, beta, mu, nu], and the Christoffel symbols   Christoffel[alpha, mu, nu]  = GAMMA[alpha, mu, nu] and Christoffel[~alpha, mu, nu]  = "GAMMA[mu,nu]^(alpha)" respectively of first and second kinds. The Tetrads  and ThreePlusOne  subpackages have other predefined related tensors. This section is thus all about computing with tensors in General Relativity.

 

Loading metrics from the database of solutions to Einstein's equations

   

Setting the spacetime metric indicating the line element or a Matrix

   

Covariant differentiation: the D_[mu] operator and the Christoffel symbols

   

The Einstein, Ricci, Riemann and Weyl tensors of General Relativity

   

A conversion network for the tensors of General Relativity

   

Tetrads and the local system of references - the Newman-Penrose formalism

   

The ThreePlusOne package and the 3+1 splitting of Einstein's equations

   

III. Transformations of coordinates

   

See Also

 

Physics , Conventions used in the Physics package , Physics examples , Physics Updates

 


 

Download Tensors_-_A_Complete_Guide.mw, or the pdf version with sections open: Tensors_-_A_Complete_Guide.pdf

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

First 596 597 598 599 600 601 602 Last Page 598 of 2097