Cody

Solution 1885805

Submitted on 27 Jul 2019 by William
  • Size: 43
  • This is the leading solution.
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
ff = 'fileread'; assert(nargin(ff)~=-1, 'empty file forbidden') filetext = fileread('myfun.m'); assert(isempty(strfind(filetext, '''')),'string forbidden') assert(isempty(strfind(filetext, 'varargin')),'varargin forbidden') assert(isempty(strfind(filetext, 'ans')),'ans forbidden') assert(isempty(strfind(filetext, 'atan')),'atan forbidden') assert(isempty(strfind(filetext, 'atan2')),'atan2 forbidden') assert(isempty(strfind(filetext, 'atand')),'atand forbidden') assert(isempty(strfind(filetext, 'atan2d')),'atan2d forbidden') assert(isempty(strfind(filetext, 'tan')),'tan forbidden') assert(~isempty(filetext),'empty file forbidden')

2   Pass
b = 0.1; n = 3; y_correct = 0.09966667; assert(abs(myfun(b,n)-y_correct)<1e-6)

3   Pass
b = 0.01; n = 5; y_correct = 0.00999967; assert(abs(myfun(b,n)-y_correct)<1e-6)

4   Pass
b = 0.2; n = 3; y_correct = 0.19733333; assert(abs(myfun(b,n)-y_correct)<1e-6)

5   Pass
b = 0.2; n = 1; y_correct = 0.20000000; assert(abs(myfun(b,n)-y_correct)<1e-6)

6   Pass
b = 0.2; n = 7; y_correct = 0.19739550; assert(abs(myfun(b,n)-y_correct)<1e-6)