Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please check the error CHW4.2. Linear Systems: Determining the temperature distribution In this problem we study the temperature distribution in a two-dimensional object, like a
Please check the error
CHW4.2. Linear Systems: Determining the temperature distribution In this problem we study the temperature distribution in a two-dimensional object, like a very thin metal plate. We can model such an object as a grid of wires, as shown below. In the example, we assume that the temperature at the exterior grid points is constant and known. Your job is to determine the temperature at the interior points in the thermal equilibrium. When the temperature distribution in the grid is stable, the temperature at each interior point is the average of the temperatures at the four adjacent points. For example, T2=4T1+T4+S7+S8. You are now given the vector S=S0. Compute T=[T0] When the temperature distribution in the grid is stable, the temperature at each interior point is the average of the temperatures at the four adjacent points. For example, T2=4T1+T4+S7+S8. You are now given the vector S=S0S8. Compute T=T0T4. The vector S is stored as a 1-d numpy array in s. Use this to compute T and store the vector in T as a numpy array of the same shape as s. The setup code gives the following variables: Your code snippet should define the following variables: Note: The use of np.linalg. solve( ) is not permitted in this question, as you may not have access to it on the exam. How else can you solve a system of equations? _code.py import numpy as np N=5 T_top, T_bottom, T_left, T_right =100,0,0,75 A=npzeros((N2,N2)) b=npzeros(N2) for i in range (N) : for j in range (N) : k=iN+j if i==0 : A[k,k]=1 b[k]=Ttop elif i==N1 : A[k,k]=1 b[k]= T_bottom elif j=0: A[k,k]=1 b[k]= T_left elif j=N1 : A[k,k]=1 b[k]= T_right else: A[k,k]=4 A[k,k1]=1 A[k,k+1]=1 A[k,kN]=1 A[k,k+N]=1 ' T ' does not have correct shape--got: ' (5,5), expected: ' (5,)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started