1-1 n 1 1+1 k+1 " - ( - Σωμα" - Σε:) b; = α 1 = 1, 2, ... , η, k = 0, 1, 2, ... aii =1 j=+1

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1-1 n 1 1+1 k+1 " - ( - Σωμα" - Σε:) b; = α 1 = 1, 2, ... , η, k = 0, 1, 2, ... aii =1 j=+1

Post by answerhappygod »

 1
1 (53.24 KiB) Viewed 16 times
using LinearAlgebra
function jacobi(A,b,x0)
x = x0;
norm_b = norm(b);
c = 0;
while true #loop for k
println(x)
pre_x = x;
for i = 1 : length(x) #loop for i
x = b;
for j = 1 : length(x)
#loop for j

#update
if i !=
j

x = x - A[i,j]*pre_x[j];
end
end
x = x/A[i,i];
end
error = norm(A*x-b)/norm_b;
c = c + 1;
if error < 1e-10
break;
end
end
println(c);
return x;
end
1-1 n 1 1+1 k+1 " - ( - Σωμα" - Σε:) b; = α 1 = 1, 2, ... , η, k = 0, 1, 2, ... aii =1 j=+1
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply