Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

LU decomposition

Status
Not open for further replies.

hoshang

Civil/Environmental
Jul 18, 2012
479
0
0
IQ
Hi all,
I wonder why LU for this matrix retrieves such LU decomposition result.
M=
-0.5 -1 0
-1 -1 -1
0 -1 -0.5

L=
1 0 0
0 1 0
0.5 0.5 1

U=
-1 -1 -1
0 -1 -0.5
0 0 0.75



While it should be:

L=
1 0 0
2 1 0
0 -1 1

 
Replies continue below

Recommended for you

The question in the OP was:
hoshang said:
I wonder why LU for this matrix retrieves such LU decomposition result.
to which the answer is:
IDS said:
there is more than one way to decompose a matrix.

The link previously posted:
has a good clear explanation of how to do LU decomposition, with and without pivoting, and why it is a good idea to use pivoting for general use, to avoid problems if there are any zeros on the leading diagonal. It also has Python code which will generate the unpivoted matrices (after applying corrections as posted above).

You haven't told us why you have to use the unpivoted matrices, or why it has to be done in Mathcad, but if both are essential for some reason, and if Mathcad doesn't have that as an option, it shouldn't be too hard to convert the Python code to Mathcad, or you could look at using:
or something similar.

Doug Jenkins
Interactive Design Services
 
PNatchwey said:
There is python library for LU decomposition.

The great majority of the code in my link is for calling the Scipy linear algebra functions from Excel, including the LU decomposition functions.

The Python routines were written purely so I (and others) can see how the process works, in response to the question in the first post of this thread.

Also note that the download file includes links to the pyPardiso library which is very much faster than the Scipy LU functions.


Doug Jenkins
Interactive Design Services
 
As said on 22nd May:

You haven't told us why you have to use the unpivoted matrices, or why it has to be done in Mathcad, but if both are essential for some reason, and if Mathcad doesn't have that as an option, it shouldn't be too hard to convert the Python code to Mathcad, or you could look at using:
or something similar.

Doug Jenkins
Interactive Design Services
 
Status
Not open for further replies.

Similar threads

Back
Top