Cody

Solution 2000880

Submitted on 3 Nov 2019 by Nikolaos Nikolaou
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   Pass
x1=[2 2 6]; x2=[1 -1 0]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-1.5))<1e-8) assert(sum(abs(y-1.5))<1e-8)

b = 6 0 A = 2 2 6 1 -1 0 A = 2 2 1 -1 l1 = 1.5000 1.5000 l2 = 0.3333 x = 1.5000 y = 1.5000

2   Pass
x1=[3 2 5]; x2=[2 2 4]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-1))<1e-8) assert(sum(abs(y-1))<1e-8)

b = 5 4 A = 3 2 5 2 2 4 A = 3 2 2 2 l1 = 1.0000 1.0000 l2 = 0.0800 x = 1.0000 y = 1.0000

3   Pass
x1=[2 1 1]; x2=[4 1 6]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-2.5))<1e-8) assert(sum(abs(y+4))<1e-8)

b = 1 6 A = 2 1 1 4 1 6 A = 2 1 4 1 l1 = 2.5000 -4.0000 l2 = 0.0667 x = 2.5000 y = -4

4   Pass
x1=[1 1 11]; x2=[1 -1 -3]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-4))<1e-8) assert(sum(abs(y-7))<1e-8)

b = 11 -3 A = 1 1 11 1 -1 -3 A = 1 1 1 -1 l1 = 4 7 l2 = 0.5000 x = 4 y = 7

5   Pass
x1=[2 1 8]; x2=[2 -1 4]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-3))<1e-8) assert(sum(abs(y-2))<1e-8)

b = 8 4 A = 2 1 8 2 -1 4 A = 2 1 2 -1 l1 = 3 2 l2 = 0.3333 x = 3 y = 2

6   Pass
x1=[1 1 2]; x2=[1 -1 -2]; [x,y] = system_solution(x1,x2); assert(sum(abs(x-0))<1e-8) assert(sum(abs(y-2))<1e-8)

b = 2 -2 A = 1 1 2 1 -1 -2 A = 1 1 1 -1 l1 = 0 2 l2 = 0.5000 x = 0 y = 2

Suggested Problems

More from this Author1