Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: What does this syntax mean
Date: Sun, 17 Jan 2010 22:58:13 -0500
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <hj0m8i$f9q$1@fred.mathworks.com>
References: <hiqlta$25v$1@fred.mathworks.com> <hiqn4j$joj$1@fred.mathworks.com> <hiqnih$h83$1@fred.mathworks.com> <hivnv0$nq5$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1263787090 15674 172.31.44.65 (18 Jan 2010 03:58:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 18 Jan 2010 03:58:10 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:599505


"Ender " <jr147@msstate.edu> wrote in message 
news:hivnv0$nq5$1@fred.mathworks.com...
> MATLAB does not give me the same answer that is in the back of the 
> Numerical Analysis book that I am using. The Matrix A is:
>
> A=[0,2,-1;1,-1,2;1,-1,4]
>
> The answer is:
>
> L = [1,0,0;1.5,1,0;1.5,1,1] & U = [2,-1,1;0,4.5,7.5;0,0,-4]
>
> When using the MATLAb LU Factorization code [L,U] = lu(A)
> I do not get this answer. I don't know why.

When I use LU in MATLAB, I too receive a different answer than the one you 
cited above.  When I check the output of the LU call in MATLAB (by computing 
L*U) I receive your original matrix.  When I check the product of the two 
matrices you gave above, I do not receive your original matrix.

It's entirely possible that your numerical analysis textbook may have the 
wrong answer, or it could be that you read the answer to the wrong problem.

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ