MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: LUDecomposition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117735] Re: LUDecomposition
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 30 Mar 2011 04:16:20 -0500 (EST)

(a) The outputs are NOT the same:

LUDecomposition[{{1, 2}, {3, 4}}]

{{{1, 2}, {3, -2}}, {1, 2}, 1}

LUDecomposition[{{3, 4}, {1, 2}}]

{{{1, 2}, {3, -2}}, {2, 1}, 1}

(b) Alpha IS wrong, as you say, on the second matrix.

(c) The documentation buries far down the page -- and why, one wonders???  
-- the critical info that l.u is not the original matrix, but a  
PERMUTATION of it:

m = {{1, 2}, {3, 4}};
{lu, p, c} = LUDecomposition@m
l = LowerTriangularize[lu, -1] + IdentityMatrix@2;
u = UpperTriangularize@lu;
l.u == m[[p]]

{{{1, 2}, {3, -2}}, {1, 2}, 1}

True

m = {{3, 4}, {1, 2}};
{lu, p, c} = LUDecomposition@m
l = LowerTriangularize[lu, -1] + IdentityMatrix@2;
u = UpperTriangularize@lu;
l.u == m[[p]]

{{{1, 2}, {3, -2}}, {2, 1}, 1}

True

Bobby

On Tue, 29 Mar 2011 06:58:37 -0500, Kevin <kjslag at gmail.com> wrote:

> LUDecomposition[{{1, 2}, {3, 4}}]
> and
> LUDecomposition[{{3, 4}, {1, 2}}]
> both give the same output:
> {{{1, 2}, {3, -2}}, {1, 2}, 1}
>
> Only the output for the first matrix is correct.
>
> Alpha gives the same incorrect results for the 2nd matrix
> correct 1st matrix:  
> http://www.wolframalpha.com/input/?i=LUDecomposition+{{1%2C2}%2C{3%2C4}}
> incorrect 2nd matrix:  
> http://www.wolframalpha.com/input/?i=LUDecomposition+{{3%2C4}%2C{1%2C2}}
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Using Nearest on a group of points
  • Next by Date: Re: About C[i]
  • Previous by thread: Re: LUDecomposition
  • Next by thread: Mathematica 6.0.1 nb working, but not on Mathematica 8.0.1.