Answered step by step
Verified Expert Solution
Link Copied!

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: x0= a matrix with height 9 and with 1, and inside matrix its all 10. TOL=0.5. The question reads: what is your estimated solution (three digits after the comma) for the temperatures T1, T2, T3, T4, T5, T6, T7, T8 and T9? How many iterations were necessary?
The python code i made and that i will use:
import numpy as np
def conjgrad(A, b, x0):
x = x0
r = b - np.dot(A, x)
p = r
rsold = np.dot(np.transpose(r), r)
while np.sqrt(rsold)>1e-8:
Ap = np.dot(A, p)
alpha = rsold / np.dot(np.transpose(p), Ap)
x = x + alpha * p
s = r - alpha * Ap
rsnew = np.dot(np.transpose(s), 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_0=
# Tolerance
TOL =0.5
# Solve using conjugate gradient method
x = conjgrad(A, b, x_0)
# Print the solution rounded to three digits after the comma
print("Estimated Temperatures:")
for i, temp in enumerate(x, start=1):
print(f"T{i}: {temp:.3f}")
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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions