Items tagged with matrix matrix Tagged Items Feed

M := Matrix([[0,1,1,1,1],[1,0,1,1,1],[1,1,0,1,1],[1,1,1,0,1],[1,1,1,1,0]]);

how to multiply M[1] which is [0,1,1,1,1] with Matrix([[x0], [x1], [x2], [x3], [x4]])
to become [0,x1,x2,x3,x4]

may not use Matrix([[x0], [x1], [x2], [x3], [x4]])

just want to use first element as x0 when it is not 0

second element as x1, etc

LM:=proc(n)
local L;
uses combinat;
L:=permute([1$(n*(n-1)/2), 0$(n*(n-1)/2)], n*(n-1)/2);
[seq(Matrix(n,{seq(seq((i+1,j)=L[k][(i-1)*i/2+j], j=1..i), i=1..n-1)}, shape=symmetric), k=1..nops(L))];
end proc:
M := LM(5);
N := nops(M);
append("E:\\mm.txt");
for i from 1 to N do
ExportMatrix( "E://mm.txt", M[i]);
od:

 

hope to export to a text file

and show

for example

matrix([[1,1,1],[1,1,0],[0,0,0]]);


matrix([[1,1,1],[1,1,0],[0,0,0]]);


matrix([[1,1,1],[1,1,0],[0,0,0]]);

...

etc

 

how to solve this eq by maple:

P:=Matrix([[ 0 , .5 , .5 , 0 , 0 , 0 ], [ 1/3 , 0 , 0 , 1/3 , 1/3 , 0 ], [ 1/3 , 0 , 0 , 0 , 1/3 , 1/3 ], [ 0 , 1 , 0 , 0 , 0 , 0 ], [ 0 , .5 , .5 , 0 , 0 , 0 ], [ 0 , 0 , 1 , 0 , 0 , 0 ]]);

 

pii:=Vector[row]([ a , b , c , d , e , f ])

 

how to find

pii.P=pii

 

Silaws

let m3 = [[0; 1; 0]; [1; 0; 1]; [0; 1; 0]]

1. Firstly, express this matrix into sequence function expression

2. how to express this matrix in terms of forloop code

3. for complicated case such as 1 is not in easy pattern, can it intelligently express the matrix in terms of for loop code

 

is there exist extra tools to express matrix in terms of for loop code or sequence function code?

how do minor generate 2*2 matrix from 5*5 matrix or n*n matrix which n >= 3

first case is the symmetric or nonsymmetric ladder matrix which fill full upper right and lower left corner

{0,1,1,1,1}
{1,0,1,1,1}
{1,0,0,0,1}
{1,1,1,0,0}
{1,1,1,1,0}

second case is overlap two different first case , one is 1 and another is 0 which is for display partial fill the upper right corner and lower right corner

{0,1,0,0,0}
{1,0,1,1,0}
{1,0,0,0,1}
{0,1,1,0,0}
{0,0,0,1,0}

Hi,

 

I want to compute the determinant of a matrix A with this formula:

 Can someone help me to do it.  Of course, here I am using Einstein's convention.

Thank you in advance.

--------------------------------------
Mario Lemelin
Maple 18 Ubuntu 14.04 LTS - 64 bits
Maple 18 Win 7 Pro - 64 bits messagerie : mario.lemelin@cgocable.ca téléphone :  (819) 376-0987

I'm computing a matrix which is a hessian of a quadratic function and it should be symmetric.

Unfortunately, because of the numerical errors, the hessian matrix becomes unsymmetric. 

Then, I want to use this matrix as the input for the QPSolve procedure, and I get the error that the matrix is unsymmetric.  

To obtain the symmetric matrix, I'm doing the following redundant computation:

A := MTM[triu](B, 1) + Transpose(MTM[triu](B)):

Is there a better solution to this problem?

following commands on my computer got an error.

restart;
with(LinearAlgebra):
A:=Matrix([[1,3],[2,5]],datatype=float):
b:=Vector([1,1],datatype=float):
LinearSolve(A,b,method=hybrid);
Error, (in SWcallhybrid[1]) param 4 should be an rtable

any suggestion is appreciated.

win7, 12.02

I noticed this in Student:-NumericalAnalysis:-Romberg, here are the lines of interest:

The question  is: Why create rtable, apply algorithm, then convert to Matrix at end? Why not replace line 4 below with Matrix command from start? Could not the same thing be done using Matrix from the start?

-----------------------------------------
proc(expr, var, a, b, n)
local f, R, j, k, i, oldDigits;
   4   R := rtable(1 .. n,1 .. n,('storage') = ('triangular')['lower']);  #Why not create Matrix here?
   6   R[1,1] := evalf(1/2*(b-a)*(f(a)+f(b)));
   7   for k from 2 to n do
   8     R[k,1] := 1/2*evalf(R[k-1,1]+(b-a)/(2^(k-2))*add(f(a+(2*i-1)*(b-a)/(2^(k-1))),i = 1 .. 2^(k-2)))
       end do;
  10   for j from 2 to n do
  11     for k from j to n do
  12       R[k,j] := evalf(4^(j-1)*R[k,j-1]-R[k-1,j-1])/(4^(j-1)-1)
         end do
       end do;
  13   R := evalf[oldDigits](R);
  14   return convert(R,Matrix,('shape') = ('triangular')['lower']) #Why not use Matrix from the start?
end proc
------------------------------------------

Maple 18.02

I have about a year of experience in Maple, but as we know, we often come accross very simple problems that are difficult to find solutions to. Part of the problem is that I have not used conditional tests within for loops before.

I have a very large matrix, but until I solidify the algorithm, I'm practicing on a small matrix.

I created a 3 by 3 fibonacci matrix A:=<21,5,1|13,3,1|6,2,0>

I am trying to change the 1s to 0s without specific index reference. Here is my psuedocode that I hope to work on after some tips:

  • for i from 1 to 9
    if A[k] = 1 then
    A[k]=0
    end if
    end do

 

I get an error message saying "unterminated for loop," which is confusing me.

Hi,

 

I have a system of equations containing curls, divergence and gradients of variables. 

How can I extract the coefficients of the equations (i.e. coefficients of d/dt rho, d/dx p) and form a matrix?

thanks.   

test.mw

restart; with(LinearAlgebra)

``

dF := -.525*exp(-7*t)+2.625*exp(-3*t)+.8*exp(-4*t);

-.525*exp(-7*t)+2.625*exp(-3*t)+.8*exp(-4*t)

(1)

``

e3 := `<,>`(1, 1, 1); E := proc (m) options operator, arrow; IdentityMatrix(m) end proc; beta := `<|>`(.1, .6, .3); S := `<|>`(`<,>`(-3, 1, 1), `<,>`(1, -5, 2), `<,>`(0, 2, -4)); S0 := -S.e3

beta := Vector[row](3, {(1) = .1, (2) = .6, (3) = .3})

 

S := Matrix(3, 3, {(1, 1) = -3, (1, 2) = 1, (1, 3) = 0, (2, 1) = 1, (2, 2) = -5, (2, 3) = 2, (3, 1) = 1, (3, 2) = 2, (3, 3) = -4})

 

S0 := Vector(3, {(1) = 2, (2) = 2, (3) = 1})

(2)

Z := `<|>`(x, y, z)

Z := Vector[row](3, {(1) = x, (2) = y, (3) = z})

(3)

ME := MatrixExponential(S+Typesetting:-delayDotProduct(S0, Z), t);

`[Length of output exceeds limit of 1000000]`

(4)

MEint := map(int, ME.dF, t = 0 .. infinity)

Error, (in int) wrong number (or type) of arguments: wrong type of integrand passed to definite integration.

 

`&beta;plus&Assign;solve`(Z = beta.MEint, Z)

"(RTABLE(18446744074195006390,VECTOR([x, y, z]),Vector[row])=RTABLE(18446744074193876574,VECTOR([.1, .6, .3]),Vector[row]).MEint) betaplus:=solve (RTABLE(18446744074195006390,VECTOR([x, y, z]),Vector[row]))"

(5)

``

1step- I want to integrate the (ME*dF) from t=0 to ∞ .

2step- Evaluate Z=<x,y,z> by solving Z=β*MEint.

Download test.mw

Hello,

I would like to ask for help with factorization, collection or decomposition of matricies. If I have the symbolic product of matrices:

A := Matrix(2, 2, {(1, 1) = a[11], (1, 2) = a[12], (2, 1) = a[21], (2, 2) = a[22]})

B := Matrix(2, 2, {(1, 1) = b[11], (1, 2) = b[12], (2, 1) = b[21], (2, 2) = b[22]})

then C:= A*B :

Matrix(2, 2, {(1, 1) = a[11]*b[11]+a[12]*b[21], (1, 2) = a[11]*b[12]+a[12]*b[22], (2, 1) = a[21]*b[11]+a[22]*b[21], (2, 2) = a[21]*b[12]+a[22]*b[22]})

and my question follows:

Can I factor this result C and get the imput matrices A and B ? Is any function for this operation ? I would like to use it for matrices 3 time 3 not only for 2 times 2.

Thank you for your help,

vidocq

 

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