Items tagged with matrix matrix Tagged Items Feed

I am working on an iterative code where I need to save a matrix in an intermediate step. My code is long and it uses a separate data file. So, I am trying to state my problem taking a simple example.

At first, I define a column matrix A0. Using A0, I do some calculations and test some conditions. 
In the next step, I want  to do similar calculations and test some conditions but this time by changing the first element of A0. For the purpose of later use, I need to save the matrix A0 in its original form. I am trying to use the following method but both A0 and A1 (modified A0) turn out to be same.

> restart;
> n := 3;
> A0 := Matrix(n, 1, 1);
> #Do some calculation with A0
> A1 := A0;
> A1[1, 1] := A1[1, 1]+.1*A1[1, 1];
> A1;
> print(A0, A1);

This might be because I set A1:=A0 in the third line. But how do I save A0 in its original form?



i want to solve a system , A.b+B.X=0 , which A is 5*5 known matrix, B is 5*2 known matrix , and b is 5*1 and X is 2*1 unknown arbitary matrices ! i want to have solution for b and X . whatever they can be ! just equation to be solved !



A := Matrix(5, 5, {(1, 1) = -.9800, (1, 2) = 0, (1, 3) = 0, (1, 4) = -0.160e-1, (1, 5) = 0, (2, 1) = 1.0000, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = -2.1900, (3, 2) = -9.7800, (3, 3) = -0.280e-1, (3, 4) = 0.740e-1, (3, 5) = 0, (4, 1) = 77.3600, (4, 2) = -.7700, (4, 3) = -.2200, (4, 4) = -.6700, (4, 5) = 0, (5, 1) = 0, (5, 2) = -79.9700, (5, 3) = -0.300e-1, (5, 4) = .9900, (5, 5) = 0})



B := Matrix(5, 2, {(1, 1) = -2.44, (1, 2) = .58, (2, 1) = 0, (2, 2) = 0, (3, 1) = .18, (3, 2) = 19.62, (4, 1) = -6.48, (4, 2) = 0, (5, 1) = 0, (5, 2) = 0})



b := Matrix(5, 1, {(1, 1) = y[1], (2, 1) = y[2], (3, 1) = y[3], (4, 1) = y[4], (5, 1) = y[5]})



X := Matrix(2, 1, {(1, 1) = x[1], (2, 1) = x[2]})



M := Matrix(5, 1, {(1, 1) = -.9800*y[1]-0.160e-1*y[4]-2.44*x[1]+.58*x[2], (2, 1) = 1.0000*y[1], (3, 1) = -2.1900*y[1]-9.7800*y[2]-0.280e-1*y[3]+0.740e-1*y[4]+.18*x[1]+19.62*x[2], (4, 1) = 77.3600*y[1]-.7700*y[2]-.2200*y[3]-.6700*y[4]-6.48*x[1], (5, 1) = -79.9700*y[2]-0.300e-1*y[3]+.9900*y[4]})



Matrix([[-0.160e-1*y[4]-2.44*x[1]+.58*x[2]], [0.], [-9.7800*y[2]-0.280e-1*y[3]+0.740e-1*y[4]+.18*x[1]+19.62*x[2]], [-.7700*y[2]-.2200*y[3]-.6700*y[4]-6.48*x[1]], [-79.9700*y[2]-0.300e-1*y[3]+.9900*y[4]]])






actually the problem to be solved is M=0 ! which directly goes to y[1]=0;
after that , how can i find other unknowns so that M=0 is ok. tnx

Hello awesome maple people

I have the following Matrix

R := Matrix([[1, -2, 2, 6, -6], [2, -3, 4, 9, -8]])

then i do


and i get an output, but is there any way to get it to give me the output in Parametric form?

Like this

Thanks in advance :)



In a recent blog post, I found a single rotation that was equivalent to a sequence of Givens rotations, the underlying message being that teaching, learning, and doing mathematics is more effective and efficient when implemented with a tool like Maple. This post has the same message, but the medium is now the Householder reflection.

Given the vector x = , the Householder matrix H = I - 2 uuT reflects x to y = Hx, where I is the appropriate identity matrix, u = (x - y) / ||x - y|| is a unit normal for the plane (or hyperplane) across which x is reflected, and y necessarily has the same norm as x. The matrix H is orthogonal but its determinant is -1, making it a reflection instead of a rotation.

Starting with x and uH can be constructed and the reflection y calculated. Starting with x and yu and H can be determined. But what does any of this look like? Besides, when the Householder matrix is introduced as a tool for upper triangularizing a matrix, or for putting it into upper Hessenberg form, a recipe such as the one stated in Table 1 is the starting point.

In other words, the recipe in Table 1 reflects x to a vector y in which all entries below the kth are zero. Again, can any of this be visualized and rendered more concrete? (The chair who hired me into my first job averred that there are students who can learn from the general to the particular. Maybe some of my classmates in graduate school could, but in 40 years of teaching, I've never met one such student. Could that be because all things are known through the eyes of the beholder?)

In the attached worksheet, Householder matrices that reflect x = <5, -2, 1> to vectors y along the coordinate axes are constructed. These vectors and the reflecting planes are drawn, along with the appropriate normals u. In addition, the recipe in Table 1 is implemented, and the recipe itself examined. If you look at the worksheet, I believe you will agree that without Maple, the explorations shown would have been exceedingly difficult to carry out by hand.


I was wondering if there is a way to represent a matrix in a reduced state.  By this I am talking about:

      | 1/3 1/3|

A:=| 1/3 1/3|  Where A is 2x2 matrix.  I would like represent it as:


           | 1 1|

A:=1/3| 1 1| is that possible with maple???




I am trying to do an hourly simulation of a solar-thermal system. The method I am using requires an inital guess for a value which is used in a series of equations. That variable is then back calculated, and checked against the initial guess. If it is too far off, the back calculated value is used as the new guess and so on...

My question is twofold. First, is there a way to create a sort of module that can execute a number of steps when called upon (i.e. the iterative process described above). Second, how can I run this for each hour of the year (the weather inputs for each hour will change) without manually executing each one, one at a time. So far my guess is to make a matrix with the weather inputs for each hour, and then have some sort of loop read the rows (hours) one at a time, pull the data from it, run the series of steps, and then store the output for that hour in a new matrix. Is this the best way to do this? If so, which functions/tools in Maple should I look into that can do this for me?


Hi there,

            I am new to maple. I want to ask a simple question.

            If I have a array, and I want its each component to take natural logarithm. How can I do?

            Eg:[2 3 4]->[ln(2) ln(3) ln(4)]

            Thanks in advance.


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





I want to analyze the runtimes on certain Linear Algebra functions in Maple, so I need a (large) set of matrices to input into these functions.

I have written the below code, which does succesfully generate a file of matrices:

The resulting file looks like:

However, I am unable to read the matrices from this file back into Maple. When using the code below, I get an error.

I think the error is that %a in fscanf scans up to the next whitespace, so the spacing in Matrix(3, 3, [[9,1,-4],[-5,6,-10],[-10,-4,-4]]) is throwing fscanf off. Do you guys know of any way I can fix this?


Or, is there a better way for me to generate these matrices so that they can be easily read into Maple? I've considered using ImportMatrix/ExportMatrix, but I believe that they only work for a single matrix, not the numerous ones that I would need. 

I have data matrix in text file.

I opened it with Maple and replaced decimal commas to decimal points + replaced column separator to semicolon.

Then I set 'Convert to plain text'.

After these modifications, I would like to export that Maple worksheet back to .txt  file with content exactly as shown on the display.

But if I export the worksheet as Maple text, extra pound signs are added to the beginning of each row. In this case I cannot import data to matrix datatype=float.

If I export the worksheet as Plain text, all the rows are destroyed and I cannot import data into matrix as well.

How can I export worksheet content, exactly as shown on display, into text file?

This post describes how Maple was used to investigate the Givens rotation matrix, and to answer a simple question about its behavior. The "Givens" part is the medium, but the message is that it really is better to teach, learn, and do mathematics with a tool like Maple.

The question: If Givens rotations are used to take the vector Y = <5, -2, 1> to Y2 = , about what axis and through what angle will a single rotation accomplish the same thing?

The Givens matrix G21 takes Y to the vector Y1 =, and the Givens matrix G31 takes Y1 to Y2. Graphing the vectors Y, Y1, and Y2 reveals that Y1 lies in the xz-plane and that Y2 is parallel to the x-axis. (These geometrical observations should have been obvious, but the typical usage of the Givens technique to "zero-out" elements in a vector or matrix obscured this, at least for me.)

The matrix G = G31 G21 rotates Y directly to Y2; is the axis of rotation the vector W = Y x Y2, and is the angle of rotation the angle  between Y and Y2? To test these hypotheses, I used the RotationMatrix command in the Student LinearAlgebra package to build the corresponding rotation matrix R. But R did not agree with G. I had either the axis or the angle (actually both) incorrect.

The individual Givens rotation matrices are orthogonal, so G, their product is also orthogonal. It will have 1 as its single real eigenvalue, and the corresponding eigenvector V is actually the direction of the axis of the rotation. The vector W is a multiple of <0, 1, 2> but V = <a, b, 1>, where . Clearly, W  V.

The rotation matrix that rotates about the axis V through the angle  isn't the matrix G either. The correct angle of rotation about V turns out to be

the angle between the projections of Y and Y2 onto the plane orthogonal to V. That came as a great surprise, one that required a significant adjustment of my intuition about spatial rotations. So again, the message is that teaching, learning, and doing mathematics is so much more effective and efficient when done with a tool like Maple.

A discussion of the Givens rotation, and a summary of the actual computations described above are available in the attached worksheet, What Gives with

Hi everybody

In the attached file, when I run the code, a confusing error message appears. Obviously, the product of a 3*2 matrix by a 2*1 matrix is possible, but Maple gives an error. These 2 matrices are multiplied correctly in another worksheet. What's the source of this error?

Thanks in advance


I have this program which when I run gives me five unique matrices as I want it. I however, when I run it again the enries of the matrices changes and I get 5 identical matrices, how can I prevent this from happening?


Hello everybody,

I would like to ask: How many ways to impose the rank deficiency of a matrix J?

1. First is the determinant(J) = 0

2. Multiply with a non-zero vector V: so that we have J*V = 0;

3. be listed......


something about the minors of the matrix? 

I hope to have as many methods as possible!

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