Items tagged with linear_algebra linear_algebra Tagged Items Feed

When maple does gauss elimination for matrice(student linalg). In "edit matrice" can i solve for x1,x2,x3..?

A := Matrix([[5, 4, 5, 4, 8, 4, 6, 1, 4], [2, 8, 4, 7, 5, 1, 9, 6, 1], [8, 4, 9, 8, 8, 8, 6, 2, 8], [7, 1, 8, 6, 6, 5, 3, 7, 7], [8, 7, 9, 4, 7, 8, 2, 7, 4], [5, 1, 7, 8, 5, 7, 2, 2, 8], [7, 4, 1, 7, 7, 1, 7, 8, 6], [2, 9, 9, 4, 7, 5, 2, 6, 8]]);

Create the vector b that is column 7 from A and the matrix C that is made from columns 1 to 6 and 8 to 9 of A (in the same order as the columns of A

i have this unfinished procedure to multiply two matrices 

multmatrix:= proc(A:matrix)

local m,n,i,j,r,c,t,a;

m:=linalg[rowdim](A);

n:= linalg[coldim](A);

i:=linalg[rowdim](B);

j:=linalg[coldim](B);

K:=array(1..m,1..n);

H:=array(1..i,1..j);

I have to solve a linear system

in Maple. A is a tridiagonal matrix.

My problem is that my matrix A is big and therefore, I have to wait too long. Is there some function in Maple that can help this problem?

Doc3.docx  

suppose my matrix is in the form as i attached in Doc3.docx

how should i find the determinant for that M1 matrix in the attached document programatically,

i fint the determinant of M matrix programatically, but how to find it for M1,M2 ........M6.

 

please help me with solution.

 

Thanks and Regards,

ppdev.

 

Hello everyone


I'm a new maple user, so I'm really sorry if this question is dumb, I've tried to find people with a similar problem but didn't find anyone.

So this is my problem: when I try to multiply a vector with a variable it gives me this:

> Restart; With(LinearAlgebra);
> B1 := [1, 2, 0, -1];
[1, 2, 0, -1]
> B2 := [0, 1, -1, 0];
[0, 1, -1, 0]
> A1 := a*B1+b*B2;

Im asked on one of my problem sheets to write a procedure to inverse a square matrix using LU factorization and using partial pivoting. I can do all of these using simple pen and paper but am struggling towrite the procedure, especially to involve the partial pivoting and to then solve the linear system. Any ideas how I can do this question?

Yesterday I wrote a post that began,

"I realized recently that, while 64bit Maple 15 on Windows (XP64, 7) is now using accelerated BLAS from Intel's MKL, the Operating System environment variable OMP_NUM_THREADS is not being set automatically."

But that first sentence is about where it stopped being correct, as far as how I was interpreting the performance on 64bit Maple on Windows. So I've rewritten the whole post, and this is the revision.

I concluded that, by setting the Windows operating system environment variable OMP_NUM_THREADS to 4, performance would double on a quad core i7. I even showed timings to help establish that. And since I know that memory management and dynamic linking can cause extra overhead, I re-ran all my examples in freshly launched GUI sessions, with the user-interface completely closed between examples. But I got caught out in a mistake, nonetheless. The problem was that there is extra real-time cost to having my machine's Windows operating system dynamically open the MKL dll the very first time after bootup.

So my examples done first after bootup were at a disadvantage. I knew that I could not look just at measured cpu time, since for such threaded applications that reports as some kind of sum of cycles for all threads. But I failed to notice the real-time measurements were being distorted by the cost of loading the dlls the first time. And that penalty is not necessarily paid for each freshly launched, completely new Maple session. So my measurements were not fair.

Here is some illustration of the extra real-time cost, which I was not taking into account. I'll do Matrix-Matrix multiplication for a 1x1 example, to try and show just how much this extra cost is unrelated to the actual computation. In these examples below, I've done a full reboot on Windows 7 where so annotated. The extra time cost for the very first load of the dynamic MKL libraries can be from 1 to over 3 seconds. That's about the same as the cpu time this i7 takes to do the full 3000x3000 Matrix multiplication! Hence the confusion.

Roman brought up hyperthreading in his comment on the original post. So part of redoing all these examples, with full restarts between them, is testing each case both with and without hyperthreading enabled (in the BIOS).

Quad core Intel i7. (four physical cores)

Hyperthreading disabled in BIOS
-------------------------------

> restart: # actual OS reboot
> getenv(OMP_NUM_THREADS);   # NULL, unset in OS

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=217.18KiB, alloc change=127.98KiB, cpu time=219.00ms, real time=3.10s

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ):
memory used=9.46KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns


> restart: # actual OS reboot
> getenv(OMP_NUM_THREADS);
                              "4"

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=216.91KiB, alloc change=127.98KiB, cpu time=140.00ms, real time=2.81s

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ):
memory used=9.46KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns


Hyperthreading enabled in BIOS
------------------------------

> restart: # actual OS reboot
> getenv(OMP_NUM_THREADS);    # NULL, unset in OS

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=217.00KiB, alloc change=127.98KiB, cpu time=202.00ms, real time=2.84s

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ):
memory used=9.46KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns


> restart: # actual OS reboot
> getenv(OMP_NUM_THREADS);
                              "4"

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=215.56KiB, alloc change=127.98KiB, cpu time=187.00ms, real time=1.12s

> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ):
memory used=9.46KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns


Having established that the first use after reboot was incurring a real time penalty of a few seconds, I redid the timings in order to gauge the benefit of having OMP_NUM_THREADS set appropriately. These too were done with and without hyperthreading enabled. The timings below appear to indicate that slightly bettern performance can be had for this example in the case that hyperthreading is disabled. The timings also appear to indicate that having OMP_NUM_THREADS unset results in performance competitive with having it set to the number of physical cores.

Hyperthreading disabled in BIOS
-------------------------------

> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=217.84KiB, alloc change=127.98KiB, cpu time=141.00ms, real time=142.00ms

> getenv(OMP_NUM_THREADS);  # NULL, unset in OS

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=7.50s, real time=1.92s


> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=217.84KiB, alloc change=127.98KiB, cpu time=141.00ms, real time=141.00ms

> getenv(OMP_NUM_THREADS);
                              "1"

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=7.38s, real time=7.38s


> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=217.11KiB, alloc change=127.98KiB, cpu time=125.00ms, real time=125.00ms

> getenv(OMP_NUM_THREADS);
                              "4"

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=7.57s, real time=1.94s



Hyperthreading enabled in BIOS
------------------------------

> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=216.57KiB, alloc change=127.98KiB, cpu time=125.00ms, real time=125.00ms

> getenv(OMP_NUM_THREADS);  # NULL, unset in OS

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=8.46s, real time=2.15s


> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=216.80KiB, alloc change=127.98KiB, cpu time=125.00ms, real time=125.00ms

> getenv(OMP_NUM_THREADS);
                              "1"

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=7.35s, real time=7.35s


> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=216.80KiB, alloc change=127.98KiB, cpu time=125.00ms, real time=125.00ms

> getenv(OMP_NUM_THREADS);  # NULL, unset in OS
                              "4"

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=8.56s, real time=2.15s


> restart:
> CodeTools:-Usage( Matrix([[3.]]) . Matrix([[3.]]) ): # initialize external libs
memory used=216.80KiB, alloc change=127.98KiB, cpu time=125.00ms, real time=125.00ms

> getenv(OMP_NUM_THREADS);
                              "8"

> M:=LinearAlgebra:-RandomMatrix(3000,datatype=float[8]):
> CodeTools:-Usage( M . M ):
memory used=68.67MiB, alloc change=68.74MiB, cpu time=8.69s, real time=2.23s

With all those new timing measurements it appears that having to set the global environment variable OMP_NUM_THREADS to the number of physical cores may not be necessary. The performance is comparable, when that variable is left unset. So, while this post is now a non-story, it's interesting to know.

And the lesson about comparitive timings is also useful. Sometimes, even complete GUI/kernel relaunch is not enough to get a level and fair field for comparison.

I'm Trying to calculate the Determinant of a 3 x 3 Matrix with symbolic entries with maple 15. But the Determinat function gives a wrong result. From the C+A-1 expression it uses only the C and ignores the rest.

When I calculate it "manually" the result is correct.

Here is what I'm doing:

 

The Maple file is attached to this question.

Hallo

I'm new in Mapleprimes and I'm looking forward to interesting discussions.

I was just wondering if and how it would be possible to use Maple for something like proving invariance of trace under unitary transformation.

So

tr(\Omega) = tr(U^{+} O U)

and

U^{+}U = I

After a number of reformulations, one arrives at an expression tr(O) = tr(U \Omega U^{+}).

Another example would be to show that (AB)^{-1} = B^{-1}A^{-1}....

I am stumped as to why LinearSolve and BackwardSubstitute(GaussianElimination) are giving me different answers (the latter gives the correct answer).  Here's what my maple session looks like:

 

Any input would be appreciated.  Thanks.

I am dissapointed. I recently upgraded to Maple 15 and I bought a license for the NAG libraries thinking that I could use NAG mark 8 chapter F12 to solve my Eigenvalue problem with large sparse matrix, in reality, there seems to be no implementation of these NAG routines in Maple. is there a way to get around this problem? I know I can also connect to MATLAB to take advantage of the integrated sparse handling but I want to avoid buying another piece of software(you know we scientist aren't millionaries).

hi

 

i have written the followin code that achieve Y from determinant of matric aa. but when i change digit my result changes. i dont know why? 

 

> restart;
> with(LinearAlgebra);
> Digits := 100;
>
> NULL;
> upsilon := .38;
> rho := 0.122e4;
> l := 0.176e-4;
> h := 2*0.176e-4;
> L := 20*h;
> NULL;
> E := 0.144e10;
> lambda := E*upsilon/((1+upsilon)*(1-2*upsilon));

I am calculating the dotproduct in maple 15 of two very large vectors. Are there any tricks/ways to speed up such a calculation? Maple is taking a very long time to execute the calculation and I am unsure whether it will actually return a result.

I'm using maple code of the form DotProduct(vector1,vector2);

 

Any advice ?

 

I start with a question, but not an how-to question, because I am puzzled by why such a routine is missing.

Why does Maple not have  generalized Schur (real and complex) factorizations with reordering?  The nice solution of many dynamic equations requires this factorization because the lhs is singular. MatLab does have such a routine. At the moment, it seems, one has to have accessible and connect to MatLab or NAG or LAPACK for such routines.

Is this...

1 2 Page 1 of 2