100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
APM1513 ASSIGNMENT 2 SOLUTIONS 2023 UNISA APPLIED LINEAR ALGEBRA LINEAR ALGEBRA R200,00   Add to cart

Other

APM1513 ASSIGNMENT 2 SOLUTIONS 2023 UNISA APPLIED LINEAR ALGEBRA LINEAR ALGEBRA

 13 views  0 purchase

APM1513 ASSIGNMENT 2 SOLUTIONS 2023 UNISA APPLIED LINEAR ALGEBRA LINEAR ALGEBRA

Last document update: 1 year ago

Preview 3 out of 17  pages

  • August 22, 2023
  • August 22, 2023
  • 17
  • 2023/2024
  • Other
  • Unknown
All documents for this subject (2)
avatar-seller
TutorMaster0820448712
APM1513
ASSIGNMENT 2
SOLUTIONS 2023
Unique number: *******

DUE DATE: 22 AUGUST 2023


APPLIED LINEAR
ALGEBRA



Page 1 of 17

,SOLUTION

octave:1> rand("state",429373610915)

octave:2> rand(1)

ans = 0.63536




SOLUTION

% (a)
A = [2 -1 3; 4 2 -5; 6 3 1];
B =[8; -9; 12];
X = A\B;
printf("\nSolution using A\\B Construct is : \n")
printf("X1=%f, \tX2=%f, \tX3=%f\n\n", X(1,1), X(2,1), X(3,1));


% (b)
A = [10 1 2; 1 10 -3; 2 1 10];
B =[3; 1.5; -9];
X = A\B;
Page 2 of 17

, printf("\nSolution using A\\B Construct is : \n")
printf("X1=%f, \tX2=%f, \tX3=%f\n\n", X(1,1), X(2,1), X(3,1));

%--------------------------------------------------------------------------------------------------------------
--

function GuassSeidel(A,B, convergeVal, maxIteration)
N = length(B);
X = zeros(N,1);
err = ones(N,1);

for i = 1:N
j = 1:N;
j(i) = [];
C = abs(A(i,j));
Check(i,1) = abs(A(i,i)) - sum(B);
if Check(i) < 0
fprintf('The matrix is not strictly diagonally dominant at row %2i\n\n',i)
end
end

iter = 0;
while max(err) > convergeVal
iter = iter + 1;
Z = X;
for i = 1:N
j = 1:N;
j(i) = [];
Xtemp = X;
Xtemp(i) = [];
X(i,1) = (B(i,1) - sum(A(i,j) * Xtemp)) / A(i,i);
end

Xs = X;
err = sqrt((X - Z).^2);

if iter >= maxIteration
break;
end
end

% Printing the ouput
printf("\nSolution using Guass Seidel Model : \n");
printf("X1=%f, \tX2=%f, \tX3=%f, ", Xs(1), Xs(2), Xs(3));
printf("Number of iterations %d\n\n", iter);
end


% part(a) using Guass Seidel
A = [10 1 2; 1 10 -3; 2 1 10];

Page 3 of 17

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller TutorMaster0820448712. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R200,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80467 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R200,00
  • (0)
  Buy now