Cody

# Problem 43211. Create tangent function out of sin and cos

Solution 1007902

Submitted on 11 Oct 2016
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
filetext = fileread('TANGENT.m'); assert(isempty(strfind(filetext, 'tan')),'tan() forbidden')

Error using fileread (line 22) Could not open file TANGENT.m. No such file or directory. Error in TestPoint1 (line 1) filetext = fileread('TANGENT.m');

2   Fail
x = 0; y_correct = 0; assert(abs(TANGENT(x)-y_correct)<0.01)

Undefined function 'TANGENT' for input arguments of type 'double'. Error in TestPoint2 (line 3) assert(abs(TANGENT(x)-y_correct)<0.01)

3   Fail
x = pi/4; y_correct = 1; assert(abs(TANGENT(x)-y_correct)<0.01)

Undefined function 'TANGENT' for input arguments of type 'double'. Error in TestPoint3 (line 3) assert(abs(TANGENT(x)-y_correct)<0.01)

4   Fail
x = -pi/4; y_correct = -1; assert(abs(TANGENT(x)-y_correct)<0.01)

Undefined function 'TANGENT' for input arguments of type 'double'. Error in TestPoint4 (line 3) assert(abs(TANGENT(x)-y_correct)<0.01)

### Community Treasure Hunt

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

Start Hunting!