Items tagged with matrix


I am working in a simulation, which requires me to create a checkerboard of values which I paint afterwards according to its value. The idea is to create a sequence of images (which I could export for every iteration and create into a gif/timelapse afterwards). The problem I am encountering is that when I try to plot it, I only obtain a difuse coloring scheme, without having a specific color for every pixel.

if you search for the color command in plots ( one of the examples is more or less the result I want, but I would like to have it without the gridlines and being able to control the color according to the value of the matrix in said position.


My current attempt, and the one closest to the solution is:


R:=Matrix(1..N,1..N, datatype=integer); for x from 1 to N do for y from 1 to N do R[x,y]:=P[x,y,2]*18+P[x,y,3]: od: od:R;
#P is the matrix where I do the calculations and R is the matrix I want to plot after every step of the calculation.

surfdata(Matrix(R), 1..N, 1..N, style=surface,
         dimension=2, labels=["x", "y"],
#the surfdata I resqued from another proyect I had. I know it is not thought for this tipe of grafs, but it was the closest I could come by.


I do not know if it is a better idea to use an Array or a Matrix to plot this. While the P array isn''t touched, I do not mind modifying in any way the R matrix

Thank you,


Ok, I'm  a confident Matlab user, but for some reason Maple befuddles me.

Let's say I have two functions, x=f(t) and y=g(t) and I want to fill both two vectors with values, with t=-n:n.  How do I construct a loop to do that?

Hello everyone, I use physics package and I input:


Setup(mathematicalnotation = true)


Setup(tensors = A[mu](X))


PDEtools:-declare(p0(X), pm(X), pp(X), pt(X), Un(X), Ucn(X))

pt := proc (X) options operator, arrow; Matrix(2, 2, [[p0(X), sqrt(2)*pp(X)], [sqrt(2)*pm(X), -p0(X)]]) end proc

U := proc (X) options operator, arrow; Matrix(2, 2, [[1, 0], [0, 1]])+I*pt(X)*(1/f)-pt(X)*pt(X)*((1/2)/f^2) end proc

Ucn := proc (X) options operator, arrow; Matrix(2, 2, [[1, 0], [0, 1]])-I*pt(X)*(1/f)-pt(X) . pt(X)*((1/2)/f^2) end proc

And after that I write:

Trace(-LeviCivita[mu, nu, rho, sigma] . Ucn(X) . ((1/6)*e*A[nu](X)+M5*KroneckerDelta[nu, 0]) . Matrix(2, 2, [[1, 0], [0, 1]]) . Uсn(X) . d_[rho](Un(X)) . Uсn(X) . d_[sigma](Un(X)))

But I get an error:

Error, (in unknown) invalid subscript selector

Thanks for the help.


Hello! I try to make friends physics package and matrixes. But I am faced with difficulties. To be more specific, to consider a code:


Setup(mathematicalnotation = true)


Setup(tensors = A[mu](X))

PDEtools:-declare(A(X), p0(X), pm(X), pp(X), pt(X), U(X), m5(X))

And then I create a matrix:

pt := proc (X) options operator, arrow; Matrix(2, 2, [[p0(X), sqrt(2)*pp(X)], [sqrt(2)*pm(X), -p0(X)]]) end proc;


It displays as:

Why do p0, pp, pm become function only one variable x1?

Interestingly that maple understands the next matrix:

Nevertheless even for function only one variable derivative works fine:

And I can construct more complicated functions:

But why is only one variable?

Hey guys,

I have this (6x1) matrix:

And I wish to factor a vector of the recurring terms out of it, this particular vector:

So that I end up with a (6x6) Matrix multiplied to that vector.


Thank you

Consider the following code:

LM := [
A := Matrix([[0,1],[1,0]]);
map(x -> A . x,LM);
A .~ LM;

where LM is a list of two matrices (just a test example), and A is some (test)matrix that I want to multiply onto each of these two matrices from the left, say. The map-construction works, as expected, but the elementwise operation .~ produces an error. Why?

Hello, im a total begineer with maple and i need help defining a matrix, i need to get this into a matrix

 anyone knows how could i put this in a matriz of n x 1?   (the one thats only a column)

any help would be greatly appreciated


Thanks in advance!

Hello I was trying to manipulate maple to write a procedure checking a matrix , say A with n rows and n columns. That matrix A given any row/column the sum of the entries for every row and column are equal. For example matrix [(-1,2)(2,-1)], every row and column in this matrix sums to 1. The entries in the matrix can be any real number.


I would like to extract the Anew matrix from the old matrix A. such that each row from Anew matrix has a square form of old matrix i.e all number from each row in the Anew form a square in my old matrix A ...

Is there any loop to determie  the Anew matrix in general  case

Such that A new

A := Matrix([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48, 49, 50]])

Anew = Matrix([[2, 13, 22, 11], [4, 15, 24, 13], [6, 17, 26, 15], [8, 19, 28, 17], [13, 24, 33, 22], [15, 26, 35, 24], [17, 28, 37, 26], [19, 30, 39, 28], [24, 35, 44, 33], [26, 37, 46, 35], [28, 39, 48, 37]])

Many thanks

I need your help  to give an answer to  this question
I would like to construct a matrix with condtion that comes in picture
How can i do this with maple????
my matrix is n+1*n+1


    I'm doing a little experimenting on Maple and I want to display 3 Matrixes side by side with text explaining what is what. I have a for cycle in which 5 sets of 3 matrixes are made. And my goal is to display each of the 5 sets.
How would I go about doing that? I've tried the following:

display(Array(print(cat("Matriz A", k, AA[k])), print(cat("Matriz B", k, BB[k])), print(cat("Matriz D", k, DD[k]))))

But with this I end up getting this instead of what I want:

Any ideas are welcome, thanks in advance.



I have a optimization question in the following picture.


Question: find matrix T(t). 


I writed a maple code. Could you view it ? You think that it is right?

The code file I writed:

 It is really very important for me. Can you help me?

Thank you. 


I've read the spec online for LinearSolve but it's not clear on the function of inplace on nonsquare matrices. For example, consider the following:


This last line outputs <2;0>, which is also the value stored in B after the operation, whereas [2] would be the desired result. In the case of A being a row vector an error is encountered due to lack of storage. Does what happened above generalise for any matrix with more rows than columns: storing the result in B, but adding zeroes to the bottom unused parts of B, due to B being larger than the solution?

Also, does anyone have any advice on an efficient method for solving A.x=b, in the case where b is a vector, and A is a large but tall (varying size, but often 5x as many rows as columns, e.g. 10000x2000) integer matrix, where most of the entries in any particular column are zero (more than 90%)? I've found the option method='modular' helps quite a lot, but not enough, any ideas for quick fixes?

I'm sorry if this sounds like a noob question. I am trying to make a matrix from a table, something like Gauss-Jordan Elimination tutor.

For example

maplet1 := Maplet([BoxCell(Table([A, B], [[1, 2], [3, 4]]), 'as_needed'), Button("OK", Shutdown())]);

How do I turn it to 2x2 matrix?Any help appreciated

restart; with(LinearAlgebra); with(Student[LinearAlgebra]); 
Z := Matrix([[3, 1, 5, 4, 5], [0, 0, 0, 0, 0], [28, 6, 4, 5, 9], [98, 5, 82, 2, 4], [24, 55, 23, 22, 90]]); 
B := Matrix([[0], [0], [0], [0], [0]]); 
A := <Z|B>:
if Row(A, 2) = ZeroVector[row](6) then A; end if;

I used the code above but it didn't work...any help appreciated

1 2 3 4 5 6 7 Last Page 1 of 45