Cody

# Problem 42306. Esoteric Trigonometry

Solution 3024301

Submitted on 1 Oct 2020
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
theta = pi/3; f_name = 'sine'; assert(isequal(trig_func_tool(theta,f_name),sin(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test1 (line 3) assert(isequal(trig_func_tool(theta,f_name),sin(theta)))

2   Fail
theta = pi/3; f_name = 'cosine'; assert(isequal(trig_func_tool(theta,f_name),cos(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test2 (line 3) assert(isequal(trig_func_tool(theta,f_name),cos(theta)))

3   Fail
theta = pi/3; f_name = 'tangent'; assert(isequal(trig_func_tool(theta,f_name),tan(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test3 (line 3) assert(isequal(trig_func_tool(theta,f_name),tan(theta)))

4   Fail
theta = pi/3; f_name = 'cosecant'; assert(isequal(trig_func_tool(theta,f_name),csc(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test4 (line 3) assert(isequal(trig_func_tool(theta,f_name),csc(theta)))

5   Fail
theta = pi/3; f_name = 'secant'; assert(isequal(trig_func_tool(theta,f_name),sec(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test5 (line 3) assert(isequal(trig_func_tool(theta,f_name),sec(theta)))

6   Fail
theta = pi/3; f_name = 'cotangent'; assert(isequal(trig_func_tool(theta,f_name),cot(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test6 (line 3) assert(isequal(trig_func_tool(theta,f_name),cot(theta)))

7   Fail
theta = pi/3; f_name = 'versine'; assert(isequal(trig_func_tool(theta,f_name),1-cos(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test7 (line 3) assert(isequal(trig_func_tool(theta,f_name),1-cos(theta)))

8   Fail
theta = pi/3; f_name = 'vercosine'; assert(isequal(trig_func_tool(theta,f_name),1+cos(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test8 (line 3) assert(isequal(trig_func_tool(theta,f_name),1+cos(theta)))

9   Fail
theta = pi/3; f_name = 'coversine'; assert(isequal(trig_func_tool(theta,f_name),1-sin(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test9 (line 3) assert(isequal(trig_func_tool(theta,f_name),1-sin(theta)))

10   Fail
theta = pi/3; f_name = 'covercosine'; assert(isequal(trig_func_tool(theta,f_name),1+sin(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test10 (line 3) assert(isequal(trig_func_tool(theta,f_name),1+sin(theta)))

11   Fail
theta = pi/3; f_name = 'haversine'; assert(isequal(trig_func_tool(theta,f_name),(1-cos(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test11 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1-cos(theta))/2))

12   Fail
theta = pi/3; f_name = 'havercosine'; assert(isequal(trig_func_tool(theta,f_name),(1+cos(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test12 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1+cos(theta))/2))

13   Fail
theta = pi/3; f_name = 'hacoversine'; assert(isequal(trig_func_tool(theta,f_name),(1-sin(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test13 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1-sin(theta))/2))

14   Fail
theta = pi/3; f_name = 'hacovercosine'; assert(isequal(trig_func_tool(theta,f_name),(1+sin(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test14 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1+sin(theta))/2))

15   Fail
theta = pi/3; f_name = 'exsecant'; assert(isequal(trig_func_tool(theta,f_name),sec(theta)-1))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test15 (line 3) assert(isequal(trig_func_tool(theta,f_name),sec(theta)-1))

16   Fail
theta = pi/3; f_name = 'excosecant'; assert(isequal(trig_func_tool(theta,f_name),csc(theta)-1))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test16 (line 3) assert(isequal(trig_func_tool(theta,f_name),csc(theta)-1))

17   Fail
theta = pi/3; f_name = 'chord'; assert(isequal(trig_func_tool(theta,f_name),2*sin(theta/2)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test17 (line 3) assert(isequal(trig_func_tool(theta,f_name),2*sin(theta/2)))

18   Fail
theta = pi/5; f_name = 'sine'; assert(isequal(trig_func_tool(theta,f_name),sin(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test18 (line 3) assert(isequal(trig_func_tool(theta,f_name),sin(theta)))

19   Fail
theta = pi/10; f_name = 'cosine'; assert(isequal(trig_func_tool(theta,f_name),cos(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test19 (line 3) assert(isequal(trig_func_tool(theta,f_name),cos(theta)))

20   Fail
theta = pi/2.5; f_name = 'tangent'; assert(isequal(trig_func_tool(theta,f_name),tan(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test20 (line 3) assert(isequal(trig_func_tool(theta,f_name),tan(theta)))

21   Fail
theta = 2*pi/3; f_name = 'cosecant'; assert(isequal(trig_func_tool(theta,f_name),csc(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test21 (line 3) assert(isequal(trig_func_tool(theta,f_name),csc(theta)))

22   Fail
theta = pi/7; f_name = 'secant'; assert(isequal(trig_func_tool(theta,f_name),sec(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test22 (line 3) assert(isequal(trig_func_tool(theta,f_name),sec(theta)))

23   Fail
theta = pi/13; f_name = 'cotangent'; assert(isequal(trig_func_tool(theta,f_name),cot(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test23 (line 3) assert(isequal(trig_func_tool(theta,f_name),cot(theta)))

24   Fail
theta = pi/31; f_name = 'versine'; assert(isequal(trig_func_tool(theta,f_name),1-cos(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test24 (line 3) assert(isequal(trig_func_tool(theta,f_name),1-cos(theta)))

25   Fail
theta = pi/1.3; f_name = 'vercosine'; assert(isequal(trig_func_tool(theta,f_name),1+cos(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test25 (line 3) assert(isequal(trig_func_tool(theta,f_name),1+cos(theta)))

26   Fail
theta = pi/3.3; f_name = 'coversine'; assert(isequal(trig_func_tool(theta,f_name),1-sin(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test26 (line 3) assert(isequal(trig_func_tool(theta,f_name),1-sin(theta)))

27   Fail
theta = pi/33; f_name = 'covercosine'; assert(isequal(trig_func_tool(theta,f_name),1+sin(theta)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test27 (line 3) assert(isequal(trig_func_tool(theta,f_name),1+sin(theta)))

28   Fail
theta = pi/0.7; f_name = 'haversine'; assert(isequal(trig_func_tool(theta,f_name),(1-cos(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test28 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1-cos(theta))/2))

29   Fail
theta = pi/0.3; f_name = 'havercosine'; assert(isequal(trig_func_tool(theta,f_name),(1+cos(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test29 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1+cos(theta))/2))

30   Fail
theta = pi/13; f_name = 'hacoversine'; assert(isequal(trig_func_tool(theta,f_name),(1-sin(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test30 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1-sin(theta))/2))

31   Fail
theta = pi/31; f_name = 'hacovercosine'; assert(isequal(trig_func_tool(theta,f_name),(1+sin(theta))/2))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test31 (line 3) assert(isequal(trig_func_tool(theta,f_name),(1+sin(theta))/2))

32   Fail
theta = pi/30; f_name = 'exsecant'; assert(isequal(trig_func_tool(theta,f_name),sec(theta)-1))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test32 (line 3) assert(isequal(trig_func_tool(theta,f_name),sec(theta)-1))

33   Fail
theta = pi/1.3; f_name = 'excosecant'; assert(isequal(trig_func_tool(theta,f_name),csc(theta)-1))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test33 (line 3) assert(isequal(trig_func_tool(theta,f_name),csc(theta)-1))

34   Fail
theta = pi/13; f_name = 'chord'; assert(isequal(trig_func_tool(theta,f_name),2*sin(theta/2)))

Unrecognized function or variable 'f_name'. Error in trig_func_tool (line 2) switch f_name Error in Test34 (line 3) assert(isequal(trig_func_tool(theta,f_name),2*sin(theta/2)))

### Community Treasure Hunt

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

Start Hunting!