MaplePrimes - Questions and Posts tagged with matrix
http://www.mapleprimes.com/tags/matrix
en-us2017 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemWed, 24 May 2017 19:34:15 GMTWed, 24 May 2017 19:34:15 GMTThe most recent questions and posts on MaplePrimes tagged with matrixhttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Questions and Posts tagged with matrix
http://www.mapleprimes.com/tags/matrix
Formatted printing of matrix multiplication
http://www.mapleprimes.com/questions/221953-Formatted-Printing-Of-Matrix-Multiplication?ref=Feed:MaplePrimes:Tagged With matrix
<p>Hi, I'm trying to show some matrix multiplication and show the pre-evaulated expression as well as the result. <br>
<br>
m1 := Matrix([[1, 2], [3, 4]]);<br>
m2 := Matrix([[5, 6], [7, 8]]);<br>
print(m1, m2 = Multiply(m1, m2))</p>
<p>What I'd really like is for the comma in the printed expression (on the left hand side) to be replaced by a multiplication or dot sign. Hopefully thanks in advance.</p>
<p>Hi, I'm trying to show some matrix multiplication and show the pre-evaulated expression as well as the result. <br />
<br />
m1 := Matrix([[1, 2], [3, 4]]);<br />
m2 := Matrix([[5, 6], [7, 8]]);<br />
print(m1, m2 = Multiply(m1, m2))</p>
<p>What I'd really like is for the comma in the printed expression (on the left hand side) to be replaced by a multiplication or dot sign. Hopefully thanks in advance.</p>
221953Tue, 23 May 2017 12:42:16 Zmqbmqb Creating a list of Matrices
http://www.mapleprimes.com/questions/221943--Creating-A-List-Of-Matrices?ref=Feed:MaplePrimes:Tagged With matrix
<p>I need to create a list of matrices.<br>
<br>
<br>
with(LinearAlgebra):<br>
interface(rtablesize=50);<br>
E:=[E1,E2,E3]:<br>
P:=[0,1,2]:<br>
N:=3:<br>
B:=[1,2,3]:<br>
for b from 1 to 12 by 5 do<br>
B:=(i,j)-><br>
if i=b+P[a] and j=b+P[a] then E[a]<br>
elif i=b+P[a] and j=b+N+2+P[a] then -E[a]<br>
elif i=b+P[a]+N+2 and j=b+P[a] then -E[a]<br>
elif i=b+P[a]+N+2 and j=b+P[a]+N+2 then E[a]<br>
else 0:<br>
end if:<br>
B[b]:=add(i,i=[seq(Matrix(20,B), a=1..3)]);<br>
end do;<br>
H:=[seq(B[b],b=1..12,5)];<br>
<br>
It isn't indexing the first and second variable, only the last one was indexed. </p>
<p>I need to create a list of matrices.<br />
<br />
<br />
with(LinearAlgebra):<br />
interface(rtablesize=50);<br />
E:=[E1,E2,E3]:<br />
P:=[0,1,2]:<br />
N:=3:<br />
B:=[1,2,3]:<br />
for b from 1 to 12 by 5 do<br />
B:=(i,j)-><br />
if i=b+P[a] and j=b+P[a] then E[a]<br />
elif i=b+P[a] and j=b+N+2+P[a] then -E[a]<br />
elif i=b+P[a]+N+2 and j=b+P[a] then -E[a]<br />
elif i=b+P[a]+N+2 and j=b+P[a]+N+2 then E[a]<br />
else 0:<br />
end if:<br />
B[b]:=add(i,i=[seq(Matrix(20,B), a=1..3)]);<br />
end do;<br />
H:=[seq(B[b],b=1..12,5)];<br />
<br />
It isn't indexing the first and second variable, only the last one was indexed. </p>
221943Sat, 20 May 2017 05:59:49 Zmacmp91macmp91Quick way to find duplicates in a matrix and set the elements equal to one another
http://www.mapleprimes.com/questions/221846-Quick-Way-To-Find-Duplicates-In-A-Matrix?ref=Feed:MaplePrimes:Tagged With matrix
<p>I wrote some procedures in an older version of Maple to sort through a matrix and find repeated elements, and then set the matrix elements equal to one another. As an example, consider the matrix:</p>
<p><img alt="Matrix(4, 4, {(1, 1) = 31774769/38880000, (1, 2) = -90858559/233280000, (1, 3) = -76547233/69984000, (1, 4) = -119275567/139968000, (2, 1) = -90858559/233280000, (2, 2) = 1506841/6480000, (2, 3) = 442249/720000, (2, 4) = 85514221/116640000, (3, 1) = -76547233/69984000, (3, 2) = 442249/720000, (3, 3) = 592249771/349920000, (3, 4) = 121562339/87480000, (4, 1) = -119275567/139968000, (4, 2) = 85514221/116640000, (4, 3) = 121562339/87480000, (4, 4) = 170546323/87480000}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])" src="http://www.mapleprimes.com/MapleImage.ashx?f=74092de620da98dcd64e82ebf9794916.gif"><br>
Due to its symmetric nature the upper triangular matrix is just the same as the lower triangular. i.e. the elements are equal: (2,1)=(1,2), (3,1)=(1,3) etc...<br>
<br>
I have attached a minimal working example Maple script, which processes an input matrix, finds repeats and sets the elements equal to one another (e.g. [1,2]=[2,1], literally printing this) and saves the output to a file using a specific format for processing by another program. The matrix in the file is numeric but the actual matrices contain a lot of algebraic terms and can get quite large. This is where my procedures struggle as they take a very, very long time to process larger algebraic matrices to group the repeats. Is there a more Maple friendly way of going about this problem rather than these "archaic" procedures?<br>
<br>
Here is the script:</p>
<p><a href="/view.aspx?sf=221846_question/duplicates_matrix_.mw">duplicates_matrix_.mw</a><br>
<br>
Thank you in advance<br>
<br>
-Yeti</p>
<p>I wrote some procedures in an older version of Maple to sort through a matrix and find repeated elements, and then set the matrix elements equal to one another. As an example, consider the matrix:</p>
<p><img alt="Matrix(4, 4, {(1, 1) = 31774769/38880000, (1, 2) = -90858559/233280000, (1, 3) = -76547233/69984000, (1, 4) = -119275567/139968000, (2, 1) = -90858559/233280000, (2, 2) = 1506841/6480000, (2, 3) = 442249/720000, (2, 4) = 85514221/116640000, (3, 1) = -76547233/69984000, (3, 2) = 442249/720000, (3, 3) = 592249771/349920000, (3, 4) = 121562339/87480000, (4, 1) = -119275567/139968000, (4, 2) = 85514221/116640000, (4, 3) = 121562339/87480000, (4, 4) = 170546323/87480000}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])" src="http://www.mapleprimes.com/MapleImage.ashx?f=74092de620da98dcd64e82ebf9794916.gif"><br>
Due to its symmetric nature the upper triangular matrix is just the same as the lower triangular. i.e. the elements are equal: (2,1)=(1,2), (3,1)=(1,3) etc...<br>
<br>
I have attached a minimal working example Maple script, which processes an input matrix, finds repeats and sets the elements equal to one another (e.g. [1,2]=[2,1], literally printing this) and saves the output to a file using a specific format for processing by another program. The matrix in the file is numeric but the actual matrices contain a lot of algebraic terms and can get quite large. This is where my procedures struggle as they take a very, very long time to process larger algebraic matrices to group the repeats. Is there a more Maple friendly way of going about this problem rather than these "archaic" procedures?<br>
<br>
Here is the script:</p>
<p><a href="/view.aspx?sf=221846_question/duplicates_matrix_.mw">duplicates_matrix_.mw</a><br>
<br>
Thank you in advance<br>
<br>
-Yeti</p>
221846Thu, 04 May 2017 10:07:59 ZAmusingYetiAmusingYetiAsk for your support
http://www.mapleprimes.com/questions/221827-Ask-For-Your-Support?ref=Feed:MaplePrimes:Tagged With matrix
<p>How do I assume variables as Matrixs for calculation?<br>
Please help me to solve this problem :</p>
<p>assume(M11::Matrix);<br>
assume(M12::Matrix);<br>
assume(M21::Matrix);<br>
assume(M22::Matrix);<br>
assume(A::Matrix);</p>
<p><br>
A := M12*M21+M11;<br>
M12 M21 + M11<br>
solve(A = 0, M12);<br>
Warning, solve may be ignoring assumptions on the input variables.<br>
M11<br>
- ---<br>
M21<br>
solve(A = 0, M12, useassumptions = true);<br>
M11<br>
- ---<br>
M21</p>
<p><br>
How can I get solution being a matrix?<br>
Thank you very much !!!</p>
<p>How do I assume variables as Matrixs for calculation?<br>
Please help me to solve this problem :</p>
<p>assume(M11::Matrix);<br>
assume(M12::Matrix);<br>
assume(M21::Matrix);<br>
assume(M22::Matrix);<br>
assume(A::Matrix);</p>
<p><br>
A := M12*M21+M11;<br>
M12 M21 + M11<br>
solve(A = 0, M12);<br>
Warning, solve may be ignoring assumptions on the input variables.<br>
M11<br>
- ---<br>
M21<br>
solve(A = 0, M12, useassumptions = true);<br>
M11<br>
- ---<br>
M21</p>
<p><br>
How can I get solution being a matrix?<br>
Thank you very much !!!</p>
221827Tue, 02 May 2017 13:35:18 Zdong25251325dong25251325Simplifying very large matrix elements
http://www.mapleprimes.com/questions/221696-Simplifying-Very-Large-Matrix-Elements?ref=Feed:MaplePrimes:Tagged With matrix
<p>I have a Maple code which generates a matrix, saves it to a .txt file and this is then read in to a C++ program. I have hit a snag with these matrices, in that they are generating absolutely enourmous .txt files. I need to get to a 5000*5000 matrix yet a 200*200 is generating a 100MB file.<br>
<br>
The matrix elements contain a lot of algebraic terms which I would like to keep general as these are defined in the C++ code. They also contain hypergeometric functions which in the example below I have left unsimplified (although they are simplified before reaching C++). I have tried various operations/combinations to simplify, but the file sizes still come out very large.</p>
<p>From previous experience expanding the expressions and then simplifying allows Maple to "do more" with it, but it does not seem to work in this instance. I have tried map(options,expr), simplify(expr,options), combine(expr,options), convert (expr,options) etc... The script attached only contains a small example 10*10 matrix on its own without the code which generates it due to the size of the code. What is the best way to simplify these matrices to generate the smallest .txt file?</p>
<p><a href="/view.aspx?sf=221696_question/Large_Matrix.mw">Large_Matrix.mw</a></p>
<p>Any help is appreciated.</p>
<p><br>
-Yeti<br>
</p>
<p>I have a Maple code which generates a matrix, saves it to a .txt file and this is then read in to a C++ program. I have hit a snag with these matrices, in that they are generating absolutely enourmous .txt files. I need to get to a 5000*5000 matrix yet a 200*200 is generating a 100MB file.<br>
<br>
The matrix elements contain a lot of algebraic terms which I would like to keep general as these are defined in the C++ code. They also contain hypergeometric functions which in the example below I have left unsimplified (although they are simplified before reaching C++). I have tried various operations/combinations to simplify, but the file sizes still come out very large.</p>
<p>From previous experience expanding the expressions and then simplifying allows Maple to "do more" with it, but it does not seem to work in this instance. I have tried map(options,expr), simplify(expr,options), combine(expr,options), convert (expr,options) etc... The script attached only contains a small example 10*10 matrix on its own without the code which generates it due to the size of the code. What is the best way to simplify these matrices to generate the smallest .txt file?</p>
<p><a href="/view.aspx?sf=221696_question/Large_Matrix.mw">Large_Matrix.mw</a></p>
<p>Any help is appreciated.</p>
<p><br>
-Yeti<br>
</p>
221696Fri, 14 Apr 2017 19:19:56 ZAmusingYetiAmusingYetiHow to define a matrix of functions depending on the line number
http://www.mapleprimes.com/questions/221670-How-To-Define-A-Matrix-Of-Functions?ref=Feed:MaplePrimes:Tagged With matrix
<p>Dears,</p>
<p>I have a question and I hope someone will be able to answer it.</p>
<p>I would like to create a matrix of functions depending on the number of the line or the arrow. I think the best is to show with a very basic example:</p>
<p>I have the following program</p>
<p style="text-align: center;"><em>n:=4:</em></p>
<p style="text-align: center;"><em>R:=Matrix(1,n):</em></p>
<p style="text-align: center;"><em>for i from 1 to n do: R(1,i):=x->i*x:end do:</em></p>
<p>So, I have a matrix, one row, n columns. At the ith column, I want to have the function f(x)=i*x.</p>
<p>Unfortutanely, with my program, I obtain for example for the first column the function f(x)=11*x. At the second column, I get the same result. It seems that I can define matrices of functions but it is impossible in the definition of the function to use the number of the column. Do you have any idea about how to write a program?</p>
<p>Any help would be very appreciated. </p>
<p> </p>
<p> </p>
<p>Dears,</p>
<p>I have a question and I hope someone will be able to answer it.</p>
<p>I would like to create a matrix of functions depending on the number of the line or the arrow. I think the best is to show with a very basic example:</p>
<p>I have the following program</p>
<p style="text-align: center;"><em>n:=4:</em></p>
<p style="text-align: center;"><em>R:=Matrix(1,n):</em></p>
<p style="text-align: center;"><em>for i from 1 to n do: R(1,i):=x->i*x:end do:</em></p>
<p>So, I have a matrix, one row, n columns. At the ith column, I want to have the function f(x)=i*x.</p>
<p>Unfortutanely, with my program, I obtain for example for the first column the function f(x)=11*x. At the second column, I get the same result. It seems that I can define matrices of functions but it is impossible in the definition of the function to use the number of the column. Do you have any idea about how to write a program?</p>
<p>Any help would be very appreciated. </p>
<p> </p>
<p> </p>
221670Tue, 11 Apr 2017 15:37:13 ZFlorianHFlorianH