Question: a ) Create a Python function called SpectralRadius that finds the spectral radius of a matrix T . Here T will depend on a matrix

a) Create a Python function called SpectralRadius that finds the spectral radius of a matrix T. Here T will depend on a matrix A, such that
T=(D-L)-1U,
where
A=([a11,a12,cdots,a1n
a21,a22,ddots,vdots
vdots,ddots,ddots,an-1,n
an1,cdots,an,n-1,a])
=D-L-U
=([a11,0,cdots,0
0,a22,ddots,vdots
vdots,ddots,ddots,0
0,cdots,0,a])-([0,a12,cdots,0
-a21,0,ddots,vdots
vdots,ddots,ddots,0
-an1,cdots,-an,n-1,0])-([0,-a12,cdots,-a1n
0,0,ddots,vdots
vdots,ddots,ddots,-an-1,n
0,cdots,0,0]).
The function needs to:
accept a matrix A;
return the spectral radius of T.
Y def SpectralRadius(A):
' 'Calculate the spectral radius of a matrix T=(D-L)???{-1}U, where D is the main diagonal of A,
L is the lower triangular matrix of A multiplied element-wise by minus 1, and U is the upper
triangular matrix of A multiplied element-wise by minus 1.
Parameters
A: nxn matrix
Returns
radius : spectral radius of T
Usage### YOUR CODE HERE ###
b) Consider the linear system given by
10x1-x2+2x3=0
-x1+11x2-x3+3x4=1
2x1-x2+10x3-x4=1
3x2-x3+x4=0.
Jsing the two functions above, plot the spectral radius and number of iterations required for the cases ={4,5,6,7}. Again, use a tolerance of 10-8 and a
naximum number of 30 iterations.
 a) Create a Python function called SpectralRadius that finds the spectral

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!