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)
n =
18
v =
2 4 6 8 10 12 14 16 18
w =
-1 1 -1 1 -1 1 -1 1 -1
o =
[]
o =
1.0e+15 *
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0209 6.4024
m =
-0.5000 0.0417 -0.0014 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000
n =
0 0 0 0 0 0 0 0 0
y =
1
|
4 | Pass |
x = pi;
assert(abs(myCos(x)-cos(x)) < 0.0001)
n =
18
v =
2 4 6 8 10 12 14 16 18
w =
-1 1 -1 1 -1 1 -1 1 -1
o =
[]
o =
1.0e+15 *
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0209 6.4024
m =
-0.5000 0.0417 -0.0014 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000
n =
1.0e+08 *
0.0000 0.0000 0.0000 0.0001 0.0009 0.0092 0.0912 0.9003 8.8858
y =
-1.0000
|
5 | Pass |
x = pi/2;
assert(abs(myCos(x)-cos(x)) < 0.0001)
n =
18
v =
2 4 6 8 10 12 14 16 18
w =
-1 1 -1 1 -1 1 -1 1 -1
o =
[]
o =
1.0e+15 *
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0209 6.4024
m =
-0.5000 0.0417 -0.0014 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000
n =
1.0e+03 *
0.0025 0.0061 0.0150 0.0371 0.0915 0.2257 0.5568 1.3738 3.3897
y =
-3.3307e-15
|
6 | Pass |
x = 5*pi/3;
assert(abs(myCos(x)-cos(x)) < 0.0001)
n =
18
v =
2 4 6 8 10 12 14 16 18
w =
-1 1 -1 1 -1 1 -1 1 -1
o =
[]
o =
1.0e+15 *
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0209 6.4024
m =
-0.5000 0.0417 -0.0014 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000
n =
1.0e+12 *
0.0000 0.0000 0.0000 0.0000 0.0000 0.0004 0.0116 0.3191 8.7493
y =
0.4999
|
2401 Solvers
1836 Solvers
405 Solvers
Compute a dot product of two vectors x and y
750 Solvers
Sum the elements in either diagonal of a square matrix
178 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!