Items tagged with linearalgebra

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

The following procedure is intended to recursively generate all vectors in the set of n dimension vectors with elements 0 to p-1. If I use a fixed value for p it works fine, but as soon as I introduced p as an argument it gives the error "Error, (in F) invalid input: F uses a 2nd argument, n, which is missing".

  if n=1 then:
    return [seq(Vector([x]),x=0..(p-1))];
    return [ seq(seq(Vector([v[],xn]),v in F(n-1)),xn=0..(p-1)) ];
  end if:
end proc:


I cannot for the life of me figure out what is wrong with the above code? Can anyone enlighten me?

Thanks in advance for your help.

fn1 and gn1 are the 2x2 matrices. For example


eq1:=evalm(Matrix(2,2, [1, 1, 0, 3])&*fn1+gn1)=Matrix(2,2,[0]);

eq2:=evalm(fn1+gn1)=Matrix(2,2, [0]);

how can we find fn1 and gn1 matrices?

I can't find in the Linear Algebra package the command for creating the duplication matrix.

The duplication matrix is the n * n rows and n * ( n + 1 ) / 2 columns that transforms vech(A)
to vec(A) where A is a symmetric n by n matrix (Magnus & Neudecker).

If it not yet in Maple itself, has someone already made a proc for it?

Harry Garst


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?

Q1: Pascal’s Matrix of order n is given by:
Sij =(i + j)!/ i!*j!
Use Mable to produce Pascal’s Matrix of order 8.

Q2: Study the Matrix decomposition (i.e. QR, LU, and LLT), then use Maple to produce these decompositions for a random Matrix of order 6.

Q3: Write one paragraph of your own to explain Moore-Penrose Inverse of a Matrix. Use Maple to find Moore-Penrose Inverse for a random Matrix of order 8.

Q4: Use Maple to find Jordan Canonical form for a random Matrix of order 10.

Q5: Use the seq command to generate the triple [i,j,k] for all possible values for 1 ≤ i,j,k ≤ 10, then plot this triple. i.e. Use nested seq .

Q6: Let F[n] be the set:
F[n] = {p / q: 1 ≤ q ≤ n,p ≤ p ≤ q}
Use Maple to find F[6].

Hi dears,

How can I detect two equivalent matrices? Is there any Maple command for this?

Also, Is there any command to verify that two matrices have the same Smith normalform?

Sincerely yours

First Question: How to define nx1 matrix Y:=(y1,y2,...,yn) ? (n is a Natural number while it is ungiven)

Second Question: How to derivative of matrix Y with respect to nx1 matrix X:=(x1,x2,...,xn) ?


My efforts for the first question:  (I know to define 6x1 matrix etc. , but I dont know to define nx1 matrix

restart: Matrix(1..6,1,symbol=y) 


My efforts for the second question:

restart; with(VectorCalculus);
Matrix([x^2, x*y, x*z]);
Jacobian([x^2, x*y, x*z], [x, y, z]);

Can you help me? 


Let matrix A be nxn matrix. How to find modal matrix M, the modal matrix for the matrix A is the n × n matrix formed with the eigenvectors of A as columns in M? (D=M^-1*A*M, where D is dioganal matrix with the eigenvalues of A on the main diagonal of D)

For example;

A := Matrix(2, 2, [-4, -2, 3, 1])

How to find M modal matrix?


I attempted to use convolution in AudioTools to convolve 2 vectors with arbitrary values, but could not since the operation is expecting numeric values.  Can this be done?    Is there not a convolution operastor in the LinearAlgebra package?  See attached:


Hello guys, i have some matrix equations.

A^(T)*X+X*A+Q = 0 , where A,Q - matrixs, X - unknown matrix, i need to solve this.

i tried to solve this from methods, but not successfully.

How can to solve this problem?


Dear readers,

For a question for my students I want them to calculate tge resulting vector from two vectors. The student had to answer by giving the length and angle of the resulting vector.

For the question the vector angle is always larger as 180 derges, the student should for example give a result of 270 degrees.

Currently I'm using the following code:


As you can see maple will always give an angle smaller than 180 degrees since the angle between two vectors is always 180 degrees or smaller.

Can anyone tell me how I should code this problem such that the rest for A4 will be 270 degrees rather than 90 degrees, as is given from the current way of coding.

Thank you in advance.

Students using Maple often have different needs than non-students. Students need more than just a final answer; they are looking to gain an understanding of the mathematical concepts behind the problems they are asked to solve and to learn how to solve problems. They need an environment that allows them to explore the concepts and break problems down into smaller steps.

The Student packages in Maple offer focused learning environments in which students can explore and reinforce fundamental concepts for courses in Precalculus, Calculus, Linear Algebra, Statistics, and more. For example, Maple includes step-by-step tutors that allow students to practice integration, differentiation, the finding of limits, and more. The Integration Tutor, shown below, lets a student evaluate an integral by selecting an applicable rule at each step. Maple will also offer hints or show the next step, if asked.  The tutor doesn't only demonstrate how to obtain the result, but is designed for practicing and learning.

For this blog post, I’d like to focus in on an area of great interest to students: showing step-by-step solutions for a variety of problems in Maple.

Several commands in the Student packages can show solution steps as either output or inline in an interactive pop-up window. The first few examples return the solution steps as output.

Precalculus problems:

The Student:-Basics sub-package provides a collection of commands to help students and teachers explore fundamental mathematical concepts that are core to many disciplines. It features two commands, both of which return step-by-step solutions as output.

The ExpandSteps command accepts a product of polynomials and displays the steps required to expand the expression:

ExpandSteps( (a^2-1)/(a/3+1/3) );

The LinearSolveSteps command accepts an equation in one variable and displays the steps required to solve for that variable.

LinearSolveSteps( (x+1)/y = 4*y^2 + 3*x, x );

This command also accepts some nonlinear equations that can be reduced down to linear equations.

Calculus problems:

The Student:-Calculus1 sub-package is designed to cover the basic material of a standard first course in single-variable calculus. Several commands in this package provide interactive tutors where you can step through computations and step-by-step solutions can be returned as standard worksheet output.

Tools like the integration, differentiation, and limit method tutors are interactive interfaces that allow for exploration. For example, similar to the integration-methods tutor above, the differentiation-methods tutor lets a student obtain a derivative by selecting the appropriate rule that applies at each step or by requesting a complete solution all at once. When done, pressing “Close” prints out to the Maple worksheet an annotated solution containing all of the steps.

For example, try entering the following into Maple:


Next, right click on the Matrix and choose “Student Calculus1 -> Tutors -> Differentiation Methods…

The Student:-Calculus1 sub-package is not alone in offering this kind of step-by-step solution finding. Other commands in other Student packages are also capable of returning solutions.

Linear Algebra Problems:

The Student:-LinearAlgebra sub-package is designed to cover the basic material of a standard first course in linear algebra. This sub-package features similar tutors to those found in the Calculus1 sub-package. Commands such as the Gaussian EliminationGauss-Jordan Elimination, Matrix Inverse, Eigenvalues or Eigenvectors tutors show step-by-step solutions for linear algebra problems in interactive pop-up tutor windows. Of these tutors, a personal favourite has to be the Gauss-Jordan Elimination tutor, which were I still a student, would have saved me a lot of time and effort searching for simple arithmetic errors while row-reducing matrices.

For example, try entering the following into Maple:


Next, right click on the Matrix and choose “Student Linear Algebra -> Tutors -> Gauss-Jordan Elimination Tutor

This tutor makes it possible to step through row-reducing a matrix by using the controls on the right side of the pop-up window. If you are unsure where to go next, the “Next Step” button can be used to move forward one-step. Pressing “All Steps” returns all of the steps required to row reduce this matrix.

When this tutor is closed, it does not return results to the Maple worksheet, however it is still possible to use the Maple interface to step through performing elementary row operations and to capture the output in the Maple worksheet. By loading the Student:-LinearAlgebra package, you can simply use the right-click context menu to apply elementary row operations to a Matrix in order to step through the operations, capturing all of your steps along the way!

An interactive application for showing steps for some problems:

While working on this blog post, it struck me that we did not have any online interactive applications that could show solution steps, so using the commands that I’ve discussed above, I authored an application that can expand, solve linear problems, integrate, differentiate, or find limits. You can interact with this application here, but note that this application is a work in progress, so feel free to email me (maplepm (at) any strange bugs that you may encounter with it.

More detail on each of these commands can be found in Maple’s help pages.


Please help me solve this question using maple (need the steps in solving).

Simple test of GaussianElimination function

Why doesn't this work? 

Also can I just confirm that for GaussianElimination (according to the help this uses LUDecomposition function with the output=['U'] option) the input is the augmented matrix of the system, the coefficient matrix augmented with the RHS)

In a separate test I got an example working using this code, but I've never seen this syntax before for A Matrix (using << it seems?)


Thank you for your help.





A := matrix(3, 3, [-3, 2, 1, 1, -2, 1, 1, 2, -3]);

Matrix(3, 3, {(1, 1) = -3, (1, 2) = 2, (1, 3) = 1, (2, 1) = 1, (2, 2) = -2, (2, 3) = 1, (3, 1) = 1, (3, 2) = 2, (3, 3) = -3})



Error, (in LinearAlgebra:-GaussianElimination) invalid input: LinearAlgebra:-GaussianElimination expects its 1st argument, A, to be of type Matrix() but received A





1 2 3 4 5 6 7 Page 1 of 8