Skip to content
DeepForgeby svx
All problems
MediumLinear Algebrala-174

Residual Norm of Eigenpair

Problem

Measure how well the pair (lam, v) satisfies the eigenvalue equation for A:

residual = ||A*v - lam*v||_2

A residual near 0 indicates an accurate eigenpair.

Hint

This is the norm of the residual vector for a single eigenpair.

Test cases

case 1
in: [[[2,0],[0,3]],2,[1,0]]
expected: 0
case 2
in: [[[2,0],[0,3]],2,[1,1]]
expected: 1
case 3
in: [[[0,1],[1,0]],1,[1,1]]
expected: 0
case 4
in: [[[4,1],[2,3]],2,[1,0]]
expected: 2.8284271247461903
Starter codePython
def eigenpair_residual(A, lam, v):
    # Your code here
    pass

4 test cases · run your code against them in the editor