Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
filetext = fileread('myCos.m');
assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')
|
2 | Pass |
filetext = fileread('myCos.m');
trigUsed = any(strfind(filetext, 'cos')) || any(strfind(filetext, 'sin')) ||...
any(strfind(filetext, 'exp'));
assert(~trigUsed, 'Cannot use MATLAB trigonometric functions')
|
3 | Pass |
x = 0;
assert(abs(myCos(x)-cos(x)) < 0.0001)
y =
1
y =
1
y =
1
y =
1
y =
1
y =
1
y =
1
y =
1
y =
1
y =
1
|
4 | Pass |
x = pi;
assert(abs(myCos(x)-cos(x)) < 0.0001)
y =
1
y =
-3.9348
y =
0.1239
y =
-1.2114
y =
-0.9760
y =
-1.0018
y =
-0.9999
y =
-1.0000
y =
-1.0000
y =
-1.0000
|
5 | Pass |
x = pi/2;
assert(abs(myCos(x)-cos(x)) < 0.0001)
y =
1
y =
-0.2337
y =
0.0200
y =
-8.9452e-04
y =
2.4737e-05
y =
-4.6477e-07
y =
6.3215e-09
y =
-6.5134e-11
y =
5.2606e-13
y =
-3.3769e-15
|
6 | Pass |
x = 5*pi/3;
assert(abs(myCos(x)-cos(x)) < 0.0001)
y =
1
y =
-12.7078
y =
18.6094
y =
-10.0099
y =
4.0011
y =
-0.2669
y =
0.6195
y =
0.4860
y =
0.5013
y =
0.4999
|
Who is the smartest MATLAB programmer?
469 Solvers
211 Solvers
Write a function man that takes a row vector v and returns a matrix H as follows..
227 Solvers
229 Solvers
50 Solvers