Cody

# Problem 1633. Find the right x in a 1. order Polynomal (y = m*x+c)

Solution 258345

Submitted on 9 Jun 2013 by J.R.! Menzinger
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
%% x = [1 2]; y = [5 6]; c = 5; y_correct = 1; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)

ans = 1

2   Pass
%% x = [1 -2]; y = [1 -2]; c = 50; y_correct = 50; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)

ans = 50

3   Pass
%% x = [1 -2]; y = [1 2]; c = 50; y_correct = -146; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)

ans = -146

4   Pass
%% x = [1 1]; y = [1 -2]; c = 50; y_correct = 1; assert(abs(getTheRightPosition(x,y,c)-y_correct)<1e-10)

ans = 1

5   Pass
%% x = [1 1]; y = [1 1]; c = 50; y_correct = NaN; assert(isequal(isnan(getTheRightPosition(x,y,c)),isnan(y_correct)))

6   Pass
%% x = [1 2]; y = [1 1]; c = 50; y_correct = NaN; assert(isequal(isnan(getTheRightPosition(x,y,c)),isnan(y_correct)))

7   Pass
%% x = [1 2]; y = [2 2]; c = 2; y_correct = Inf; assert(isequal(isinf(getTheRightPosition(x,y,c)),isinf(y_correct)))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!