logo

Crowdly

Browser

Add to Chrome

The following Python function implements  LU Factorization without pivoting, bu...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

The following Python function implements LU Factorization without pivoting, but it contains a critical error. Which issue most severely impacts correctness?

import numpy as np

def buggy_lu(A):

    n = len(A)

    L = np.eye(n)       # Line 1

    U = np.copy(A)      # Line 2

    for i in range(n):

        for j in range(i+1, n):

            L[j, i] = U[j, i] / U[i, i]              # Line 3

            U[j, i+1:] -= L[j, i] * U[i, i+1:]       # Line 4

            U[j, i] = 0                              # Line 5

    return L, U

0%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.astanait.edu.kz?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome