# Items tagged with matricesmatrices Tagged Items Feed

### Camera Profiler...

March 24 2016 Maple 18
4
0

CameraProfiler.mw

D700_Profile.xlsx

This Application uses the xrite color checker to obtain Forward and Color Matrices as defined by Adobe.

It compares the camera gamut based on the above matrices to the 1931 Standard Observer using LEDs.

### How to solve a matrix system?...

December 04 2015
1 2

assume a,b,c,d,B2,B3 are matrices and y is unknown

eq2 := a*b+c*d+a;
eq3 := a*c+c*d+c;
eq4 := a*b+c*a+b*c;
eq5 := a*b+a*d+b*c;
solve([eq2=B2,eq3=B3,eq4=B2,eq5=y],[a,b,c,d]);

which function can solve this kind of system of matrices?

how to solve a,b,c,d in terms of y?

### How to combine 4 matrices in one ?...

September 22 2015
2 10

a1 := Matrix(3, [1, 2, 3, 7, 8, 9, 13, 14, 15]);
a2 := Matrix(3, 2, [5, 6, 11, 12, 17, 18]);
a3 := Matrix(2, [19, 20, 25, 26]);
a2 := Matrix(3, 2, [5, 6, 11, 12, 17, 18]);

i want to combine above matrices in big matrix like

A := Matrix(2, 2, [a1, a2, a3, a4]);

best regards

### Maple not doing matrix mult...

August 15 2015
2 3

Here is my code

restart;
with(LinearAlgebra):
P := unapply(Matrix(4, 4, {(1, 1) = p[w], (1, 2) = p[x], (1, 3) = p[y], (1, 4) = p[z], (2, 1) = -p[x], (2, 2) = p[w], (2, 3) = -p[z], (2, 4) = p[y], (3, 1) = -p[y], (3, 2) = p[z], (3, 3) = p[w], (3, 4) = -p[x], (4, 1) = -p[z], (4, 2) = -p[y], (4, 3) = p[x], (4, 4) = p[w]}),(p[w],p[x],p[y],p[z]));
evalm(P(x,y,z,w));

(y1, y2, y3, y4) -> rtable(1 .. 4, 1 .. 4, {(1, 1) = y1,

(1, 2) = y2, (1, 3) = y3, (1, 4) = y4, (2, 1) = -y2,

(2, 2) = y1, (2, 3) = -y4, (2, 4) = y3, (3, 1) = -y3,

(3, 2) = y4, (3, 3) = y1, (3, 4) = -y2, (4, 1) = -y4,

(4, 2) = -y3, (4, 3) = y2, (4, 4) = y1}, datatype = anything,

subtype = Matrix, storage = rectangular, order = Fortran_order)

S:=Matrix(3,5):
for j from 1 to 3 do;
for k from 1 to 5 do;
S[j,k]:=P(seq(RandomTools[Generate](integer(range = 0 .. 4)),i=1..4));;
end do:
end do:
S;
W:=Matrix(3,5):
for j from 1 to 3 do;
for k from 1 to 5 do;
W[j,k]:=Transpose(S[j,k]);;
end do:
end do:
W;

M:=Matrix(3,3,shape=symmetric):
for j from 1 to 3 do;
for k from 1 to j do;
M[j,k]:=P(x[j,k],y[j,k],z[j,k],w[j,k]);
end do:
end do:
M;
N:=Matrix(3,3,shape=antisymmetric):
for j from 1 to 3 do;
for k from j+1 to 3 do;
N[j,k]:=P(u[j,k],v[j,k],q[j,k],r[j,k]);
end do:
end do:
N;
H:=M+N;
(Transpose(W)[2].H.Transpose(Transpose(S)[2]));

I would like the output to be a 4x4 matrix.

### Error in calculation with Maple...

June 26 2015
0 6

Dears, When I run calculation in Maple I found an error in matrices. See the file

### construct a matrix with some conditions...

June 23 2015
0 3

hi

I am trying to construct a series of 10X10 matrices whose main diagonal contains exactly k ones and other entries zero.

plz suggest thanks

### Express Matrices Using Specific Basis...

June 08 2015
0 5

Hi all,

I am considering a scenario in which I have, for example, four matrices, A, B, C, and D, which form a basis for all of the (numerical) calculations I am doing.  (For example, A + B = i*C, etc.)  Right now, if I add A and B, I get a matrix back whose elements are i*C, but I cannot get Maple to express it as i*C.  As a simple example, let:

A = (1 0 // 0 1 )

B = (0 1 // -1 0)

C = (i i // -i i)

Then A + B returns (1 1 // -1 1); I'd like for Maple to "intelligently" give iC.  So...how can I get Maple to expand a given matrix (A+B) in terms of a particular basis (here, simply C)?

Thank you.

### Issue using matrix sparse storage...

May 18 2015
1 9

Consider the following code, which just generates two "identical" matrices, differing only in their requested storage type, and then does some simple manipulations.

restart;
#
# Define matrix using sparse storage
#
testM:= Matrix( 40,40,
(i,j)->`if`(j>=i,1,0),fill=0,
storage=sparse
):
#
# Define identical(?) matrix with rectangular storage
#
nm:= Matrix( 40,40,
testM,
storage=rectangular
):
#
# Define procedure to return some matrix properties
#
matData:= proc( myMat::Matrix)
return op(3, myMat)[2], # check storage type
myMat[5, 1..-1], # get 5-th row
end proc:
#
# Get properies of the two matrices - should be identical
# but check result of adding elements in the 5-th row
#
matData(testM);
matData(nm);

The matData procedure ought to produce the same results for the two matrices, with the exception of the storrage type. But the 'add()' command does not. The 'myMat[5, 1..-1]' command produces the same vector, the 5-th row - but stick an add() wrapper around it and all hell breaks loose.

Is this a bug or am I missing something?

Suggestions such as avoiding sparse data storage are not really acceptable: the above is a much simplified version of my original problem where I was using graph theory to play with a "cost function" and (with G a graph) the command,

WeightMatrix(MinimalSpanningTree(G))

returned a sparse-storage matrix - and I didn't notice. There appears to be no option on the WeightMatrix() command to control the storage tyoe of the returned matrix. Result was that all subsequent code based on slicing/dicing/and particularly 'add()ing' sub-blocks of this weight matrix fell apart

Don't get me wrong: I can sort of accept that the weight matrix of minimal spanning tree would (hopefully) be mainly zeros so sparse-storage might be a good default option but I don't see why the results of a command such as

should vary depending on the internal storage used for the matrix, particularly when I have no control over the storage type being adopted

### how to make Maple display a large 4 by 4 matrix wi...

March 02 2015
1 0

Maple 18.02 on windows. A 4 by 4 matrix, does not display on the screen in nice formating when it has too many elements to fit current screen. But I'd like it to be displayed in 2D just like all the other 4 by 4 matrices and then use the horizontal scroll bar if needed to see the full matrix. Is this possible?

------------------------------------

restart;
z:=theta__1:
T01:=Matrix([
[cos(z),   0,   sin(z),   L*cos(z)],
[-sin(z),  0,  -cos(z),   L*sin(z)],
[0,         1,  0,          0],
[0,         0,  0,          1]]):

z:=theta__2:
T12:=Matrix([
[cos(z),    0,   -sin(z),   L*cos(z)],
[sin(z),    0,    cos(z),   L*sin(z)],
[0,         1,  0,          0],
[0,         0,  0,          1]]):

z:=theta__3:
T23:=Matrix([
[cos(z),    0,   -sin(z),   L*cos(z)],
[sin(z),    0,    cos(z),   L*sin(z)],
[0,         -1,  0,          0],
[0,         0,  0,          1]]):

T02   := T01.T12;
T03   := T02.T23;
LinearAlgebra[Dimension](T03);
------------------------------------------------

T02 above displays in 2D fine. But T03 does not on standard 100% zoom on my monitor. Screen shot:

When I changed the zoom to 50%, now it did format ok on the screen:

May be I need a way to activate the horizontal screel bar? I really do not want to keep changing zoom each time I want to see a larger matrix. All the matrices are 4 by 4, but some of them can end up with many terms in each entry.

### Hide variables in results of Jacobian / Diff ...

January 22 2015
1 3

Hi,

for my simulation I have to calculate several gradients and jacobian matrices. The equations are quite complex and with my current setup hard to read.

Here is some exampel code:

restart;
with(VectorCalculus);
SetCoordinates(cartesian[x, y, z]);
alias(u = u(t, x, y, z), v = v(t, x, y, z), w = w(t, x, y, z)); alias(eta = eta(t, x, y, z));
U := VectorField(`<,>`(u, v, w));
Divergence(U);
Jacobian(U);
Diff(U, t);

The Divergence operator gives me a very compact result:

But Jaobian and Diff look like:

To achive a better readability I want to do two things (if possible):

1) hide the independet variables (t,x,y,z) in the result of Jacobian, Diff

2) display the result of Diff in a row vector (3x1) instead

Is this possible?

### Is there an error in documentation? vertical bar |...

January 01 2015
2 4

I am trying to learn the <> notation to enter matrices and vectors. But I find this page very confusing

http://www.maplesoft.com/support/help/maple/view.aspx?path=examples%2FLA_Syntax_Shortcuts

it says:

but we see clearly the vertical bars are used to separate columns.

Isn't a column the thing that goes from the top to bottom and not from left to right in Maple LinearAlgebra?

### Algorithm for checking permutations ...

October 16 2014
3 4

Hi all

Can anybody suggest an algorithm allowing to detect, that two matrices of the same size can be obtained each from other by permutations of rows and columns? Maybe, such an algorithm there exists in LinearAlgebra package?

### how to solve possible matrix which element can onl...

October 06 2014
0 0

is it possible to assume element of matrix 0 or 1

how to write?

after write this, is it possible to display possible matrices which each element is 0 or 1

with(LinearAlgebra):
GetRing := proc(sol)
ringequation := 0;
mono1 := 0;
for j from 1 to 3 do
mono1 := 1;
for i from 1 to nops(sol[1][j]) do
mono1 := mono1*op(i, sol[1][j]);
od:
ringequation := ringequation + mono1;
od:
return ringequation;
end proc;
M := Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]]);
sys := a*b+a = GetRing(MatrixMatrixMultiply(Matrix([[a,b,c]]), M));
solve(sys);

### Create DNG Matrices Using Optimization...

September 20 2014 Maple 18
2
0

Obsolete

See my Camera Profiler application instead.

This application creates DNG matrices by optimizing Delta E from a raw photo of x-rites color checker. The color temperature for the photograph is also estimated.  Inputs are raw data from RawDigger and generic camera color response from DXO Mark.

 Initialization

XYZoptical to RGB to XYZdata

Sr,g,b is the relative spectral transmittance of the filter array not selectivity for XY or Z of a given color.

Pulling Sr,g,b out of the integral assumes they are scalars. For example Sr attenuates X, Y and Z by the same amount.

Raw Balance is not White Point Adaptation.

The transmission loss of Red and Blue pixels relative to green is compensated by D=inverse(S). The relation to incident chromaticity, xy is unchanged as S.D=1.

(See Bruce Lindbloom; "Spectrum to XYZ" and "RGB/XYZ Matrices" also, Marcel Patek; "Transformation of RGB Primaries")

 • XYZ to RGB

 • RGB to XYZ (The extra step of adaptation to D50 is included below)

 Functions

 Input Data

 Solve for Camera to XYZ D50 and T

### Recursive zero finder...

September 10 2014
1 6

Hey I have a list of matrices and I want to define a proc that will search through the first matrices entries looking for zeroes, and if it finds one to move on to the next matrix in the list and look for zeroes and so on. if for some reason all matrices in the list have zeroes i would like the proc to answer with 0. otherwise I would like it to answer with the ndex of the first matrix wth all non-zero entries. I've played with things and occasionally made things work. But in general I do not have a solution. This is what I'e tried:

Things like this:

recu:=proc(y,n,q)
options trace;
local f,j,t,k;
t[y]:=y:
k:=y:
for f from 1 to n while y<=q do;
for j from 1 to n do;
if evalb(C[k](f,j)=0) then;
t[y+1]:=t[y]+1;
recu(t[y+1],n,q);
else next;
end if;
end do;
end do;
end proc;

like this:

recu:=proc(y,n,q)
local f,j,t,k;
global S;
options trace;
S:=0;
if y=q then return "no";
end if;
for f from 1 to n do;
for j from 1 to n do;
if evalb(C[y](f,j)=0) then;
recu(y+1,n,q);
S:=S+1;
end if;
end do;
end do;
end proc;

And I think I understand well why these are not workinging however I wondered what I can do that will be syntactically (sp?) correct.

Thanks

 1 2 3 4 Page 1 of 4
﻿