Cody

Problem 977. Forward Substitution

Solution 1981930

Submitted on 18 Oct 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
A=[2 0 0; 3 5 0; 7 8 9]; b=[2; 8; 24]; y_correct = [1; 1; 1]; assert(isequal(my_forsub(A,b),y_correct))

Unrecognized function or variable 'n'. Error in my_forsub (line 6) b(j+1:n)=b(j+1:n)-A(j+1:n,j)*x(j); Error in Test1 (line 4) assert(isequal(my_forsub(A,b),y_correct))

2   Fail
A=[2 0 1; 3 5 0; 7 8 9]; b=[2; 8; 24]; y_correct = [inf]; assert(isequal(my_forsub(A,b),y_correct))

Unrecognized function or variable 'n'. Error in my_forsub (line 6) b(j+1:n)=b(j+1:n)-A(j+1:n,j)*x(j); Error in Test2 (line 4) assert(isequal(my_forsub(A,b),y_correct))

3   Fail
A=[7.9200 0 0 9.5900 8.4900 0 6.5600 9.3400 7.4300]; b=[15.8400 44.6500 93.1500]; y_correct = [2; 3; 7]; assert(isequal(my_forsub(A,b),y_correct))

Unrecognized function or variable 'n'. Error in my_forsub (line 6) b(j+1:n)=b(j+1:n)-A(j+1:n,j)*x(j); Error in Test3 (line 8) assert(isequal(my_forsub(A,b),y_correct))

Suggested Problems

More from this Author4