0
$\begingroup$

Basically what I need to do is this:

Write an algorithm that finds the LU factorization of the following matrix. The algorithm should perform the necessary elementary row operations to reduce A to U, and store the various multipliers in each step. The output of the program should be two matrices: L and U.

A={{3,1,2}{6,3,4},{3,1,5}} 

I can't use any of the built in code for LU or partial pivoting or any of that stuff that will finish it off with one function. I just need a little help getting started being as how I'm still new to programming. I know how I would do it all manually but writing the code for a general algorithm is eluding me. I'll obviously need to use for loops to test if

A[[2,1]]=0, A[[3,1]]=0

And that is about as far as I am. Any help would be greatly appreciated.

$\endgroup$
  • $\begingroup$ Dupe? $\endgroup$ – J. M.'s technical difficulties Oct 30 '15 at 3:21
  • 1
    $\begingroup$ In any case, you'll want to look up Golub and Van Loan; there's a nice discussion there on how to implement this. $\endgroup$ – J. M.'s technical difficulties Oct 30 '15 at 3:22
  • $\begingroup$ Problems with your matrix? Check using PseudoInverse[{{3, 1, 2} {6, 3, 4}, {3, 1, 5}}] $\endgroup$ – thils Oct 30 '15 at 7:03
  • $\begingroup$ @thils, for somebody just starting to understand Gaussian elimination, SVD is like handing a toddler a mountain bike. $\endgroup$ – J. M.'s technical difficulties Oct 30 '15 at 8:16
  • $\begingroup$ @JM What I am trying to convey is that LU factorization will run into problems for matrices with no inverse or near singular matrices. $\endgroup$ – thils Oct 30 '15 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.