Items tagged with linearalgebra linearalgebra Tagged Items Feed

for the questions below

you can use A,B,C as single varible or matrix form if needed

you can use A,B,C as single varible or matrix form if needed

 

1.how to calculate AA1, AA2 and B2 in terms of A,B,C?

2.how to calculate A,B,C in terms of AA1, AA2 and B2 ?

xrestart;

with(LinearAlgebra):
A := Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]]);
B := Matrix([[b1,b2,b3],[b4,b5,b6],[b7,b8,b9]]);
C := Matrix([[c1,c2,c3],[c4,c5,c6],[c7,c8,c9]]);
#AA1,AA2, C:=seq(Matrix(3, symbol=i), i=[a,b,c]);
#AA1 := Matrix([[aaa1,0,0],[0,aaa1,0],[0,0,aaa1]]);
#AA2 := Matrix([[aab1,0,0],[0,aab1,0],[0,0,aab1]]);
#B2 := Matrix([[aabb1,0,0],[0,aabb1,0],[0,0,aabb1]]);
AA1 := Matrix([[aaa1,aaa2,aaa3],[aaa4,aaa5,aaa6],[aaa7,aaa8,aaa9]]);
AA2 := Matrix([[aab1,aab2,aab3],[aab4,aab5,aab6],[aab7,aab8,aab9]]);
B2 := Matrix([[aabb1,aabb2,aabb3],[aabb4,aabb5,aabb6],[aabb7,aabb8,aabb9]]);
eq2 := C.A+C.B;
eq3 := C.B+C;
eq4 := B+C.A;
ABC := fsolve(map(t->Equate(op(t))[], [eq2=AA1,eq3=AA2,eq4=B2]));

Suppose we are given a matrix M[n*2n] of n linearly independent row vectors. Then I am trying to create a procedure to add n more linearly independent row vectors to this matix resulting in to a matrix M[2n*2n].

Consider this easy example, if the given matrix $M_{2*4}$ is

Matrix(2, 4, {(1, 1) = 4, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 4, (2, 4) = 1}) 
then we can add $[0,0,0,1]$ and $[0,0,1,0]$ to obtain the matrix $M_{4*4}$

Matrix(4, 4, {(1, 1) = 4, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 4, (2, 4) = 1, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 1, (4, 4) = 0})

 

Can I use rref form?Thank you for your help.

 

 

a := Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})with(LinearAlgebra)

 

a.a^T = (Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})).(Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4}))^TNULL

I am not getting the answer.

I want to get the answer for this product of matrix and its tranport.

I do not want to create transport matrix again for this calculation.

The transporse matrix b is

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

a.a^T is equal to a.b = Matrix([[5, 11], [11, 25]])NULL

For large matrices i cannot do this. Hence this request.Any one please send the code. Thanks.

 

Download transpose_doubt_1.mwtranspose_doubt_1.mw

Ramakrishnan V

rukmini_ramki@hotmail.com

I have a multivariate polynomial in x and y. How can I firstly collect the terms with respect to the powers of x and y and then simplifying their coefficients.

restart

with(RealDomain):

with(LinearAlgebra):

A := Matrix(5, 5, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (1, 5) = 1, (2, 1) = 1, (2, 2) = 0, (2, 3) = c__1, (2, 4) = y, (2, 5) = c__2, (3, 1) = 1, (3, 2) = c__1, (3, 3) = 0, (3, 4) = c__3, (3, 5) = x, (4, 1) = 1, (4, 2) = y, (4, 3) = c__3, (4, 4) = 0, (4, 5) = c__4, (5, 1) = 1, (5, 2) = c__2, (5, 3) = x, (5, 4) = c__4, (5, 5) = 0})

Matrix(%id = 4510803138)

(1)

B := Determinant(A)

-2*c__1^2*c__4+2*c__1*c__2*c__3+2*c__1*c__2*c__4-2*c__1*c__2*x+2*c__1*c__3*c__4-2*c__1*c__3*y-2*c__1*c__4^2+2*c__1*c__4*x+2*c__1*c__4*y+2*c__1*x*y-2*c__2^2*c__3-2*c__2*c__3^2+2*c__2*c__3*c__4+2*c__2*c__3*x+2*c__2*c__3*y-2*c__2*c__4*y+2*c__2*x*y-2*c__3*c__4*x+2*c__3*x*y+2*c__4*x*y-2*x^2*y-2*x*y^2

(2)

``

 

Download A.mw

I tried doing LinearSolve with my own matrices, thought maybe there was a mistake there so I copied the example from Maple's website and it won't execute. Instead of printing an output matrix, it just prints LinearSolve(input matrix 1, input matrix 2). I feel this is a very simple syntax mistake, but I can't figure it out!

Hello,

While doing some tests, we encountered an issue with LinearAlgebra[ConditionNumber], possibly caused by another routine in the LinearAlgebra package (MatrixInverse?). I include an example worksheet bug-maple.mw for easy testing.

To reproduce, you should start by creating this matrix:

restart;
with( LinearAlgebra ):
Digits := 50:
n := 4;
M := [ seq( cos( Pi*j/n ), j=0..n ) ];
V := VandermondeMatrix( M );

Now compute the condition number (infinity-norm) of V:

c1 := ConditionNumber(V);
c1 := simplify(%);
evalf(c1); # this gives exactly 40

We can still compute this exactly and get 40.

This is the same result as with linalg[cond]:

c2 := linalg[cond](V);
c2 := simplify(%);
evalf(c2);

Now increase the value of n to 5 and redo the test.
The exact result should be 120, but LinearAlgebra[ConditionNumber] gives the wrong result!
On the other hand, linalg[cond] gives the correct, exact result (after simplification).

n := 5; # this gives a wrong result :-(

We could use Norm(V) * Norm(Inv(v)) since this should be equal to the condition number.
But then it seems there's something bad inside the MatrixInverse routine.
Again, linalg[inverse] gives the correct, exact result.
So compare the two results:

n := 4;
simplify(MatrixInverse(V));
linalg[inverse](V);

Finally, to make matters even worse, ConditionNumber gives completely wrong results when using a float-matrix, while linalg[cond] does not:

n := 3;
V := VandermondeMatrix( evalf(M) );
c1 := ConditionNumber( V );
c2 := linalg[cond]( V );

For n=3, we get c1=10.6 and c2=16.
For n=4, we get c2=5 and c2=40.
For n=5, we get c1=68.07 and c2=119.999.

Is this what it looks like? With it being a really, really ugly bug?

-- Many thanks for your reply,

Franky

hello everybody!

I want to create a random symmetric matrix which have det=2. I just made it like this, no better than those ones. Thanks!

Doixung := proc (n)

local A, i, j; A := Matrix(n);

n := LinearAlgebra[Dimension](A);

for i to n do A[i, i] := RandomTools[Generate](integer(range = 1 .. 20))

   end do;

for i to n do

     for j to n do

           while j < i do A[i, j] := RandomTools[Generate](integer(range = 1 .. 20)) end do;

           while i < j do A[i, j] := A[j, i] end do

     end do

end do;

print(A) end proc

Hello everbody!

Jacobi:=proc(A::Matrix,b::Vector,x,epsilon,m)  

uses LA=LinearAlgebra;  

local      i,k,n:= LA:-RowDimension(A),    

        x:= Vector(LA:-RowDimensions(A)),    

        p:= Vector(LA:-RowDimensions(A));  

k:=1;

 while  k<=n do      

       for i to n while i<>j do          

          x[i]:=1/(A[i,i])*(-add(A[i,j]*p[j],j=1..n)+b[i]);       end do;      

        if abs(x-p)<epsilon do return x; end if;    

       k:=k+1;    

       p:=x;

 end do;  

x;  

end proc:

assume there is vector a,b,c and d which are real number or floating number

how to express a in linear combination of b ,c and d

in another words, how to find coefficient m1, m2, m3

in a = m1*b + m2*c + m3*d

 can LinearSolve do this?

 

 

Hello every one. I writed:

M:=-2,-1,0,1,2:
f:=x->2^x
with(LinearAlgebra);
for i from 2 by 1 to nops(M) do
for j from 2 by 1 to i
Q(i,j)->((x-M[i-j])*Q(i,j-1)-(x-M[i])*Q(i-1,j-1))/(M[i]-M[j-1]):
A:=Matrix(Q,nops(M),nops(M)+1):

end do;
end do;
print(A)
But I don't know wrong in my code. That is Neville algorithm

can you help me? sorry, my English is not very good

I want to make a package that I have created work with the LinearAlgebra package that comes with Maple. My package loads into a worksheet fine, but when I try to use one of my procedures, most of which depend upon procedures in the Linear Algebra package, the executable part of my procedure from my package is simply echoed to the screen and not executed. If I then copy the echoed part to a command prompt then it executes fine. How do I make my package use the commands in the Linear Algebra package?

Trying to get this function to work in Maple 18 

CharacteristicPolynomial(M,x)

I am trying to creat a way to solve matrix differential equations step by step.

 

How to generate all basis of a set? (rather an the one basis that basis generates)

Dear all,

I have one probem in using Maple in comparison with Matlab.

Generally, when using Matlab, I write a long program with 500 lines (for example) and where I use some matricial calculations and other. When I want to repeat this program for some parameters (variables) many times, I transform the program to a procedure "Function" with just adding the command Function in the start of the program.

When using Maple, I have a difficulty to transform a long program which I want to repeat for some variables to a procedure "proc". The program uses packages like LinearAlgebra and other procedures.

Is there a simple way to transform a long Maple program to a procedure which should be repeated many times for some variables in Maple. 

I have especially problems with the commands local, global, use (for packages), etc.. and the warning related to the variables. It is not easy for a long program with many variables to write them in local or global variables.

Thank you.

Hey,

I wanted to calculate the eigenvalues and vectors of the following matrix:

A:=Matrix(6, 6, {(1, 2) = k_noho2*NO, (2, 2) = -k_noho2*NO, (2, 5) = k_ipro*O2, (2, 6) = k_hypro*O2, (3, 3) = -k_ro2no*NO, (4, 4) = -k_ro2no*NO, (5, 3) = .991*k_ro2no*NO, (5, 5) = -k_ipro*O2, (6, 4) = .977*k_ro2no*NO, (6, 6) = -k_hypro*O2}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

There are no problems with calculating the eigenvalues, but when trying for Eigenvectors(A) it's telling me

Error, (in LinearAlgebra:-Eigenvectors) cannot determine if this expression is true or false: 0 < k_noho2*NO
So what's the problem here?

 

1 2 3 4 5 6 Page 1 of 6