Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the system of linear equations I have built, figure out the temperatures of the nodes and how many iterations using my python code of
Using the system of linear equations I have built, figure out the temperatures of the nodes and how many iterations using my python code of the conjugate gradient method. The linear equation I built was based of a thin plate. I have linked my linear equation and I need to use the computer program i have built based of the conjugate gradient method to solve the built linear equation.I also need to be using these variables to solve it: x a matrix with height and with and inside matrix its all TOL The question reads: what is your estimated solution three digits after the comma for the temperatures T T T T T T T T and T How many iterations were necessary?
The python code i made and that i will use:
import numpy as np
def conjgradA b x:
x x
r b npdotA x
p r
rsold npdotnptransposer r
while npsqrtrsolde:
Ap npdotA p
alpha rsold npdotnptransposep Ap
x x alpha p
s r alpha Ap
rsnew npdotnptransposes s
beta rsnew rsold
p s beta p
r s
rsold rsnew
return x
# Define the matrix A and vector b
A
# Initial guess for x
x
# Tolerance
TOL
# Solve using conjugate gradient method
x conjgradA b x
# Print the solution rounded to three digits after the comma
printEstimated Temperatures:"
for i temp in enumeratex start:
printfTi: temp:f
I have trouble understanding how to figure out what b is and how to put everything in to the code and what the answer to the question is
Thank you
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