Cody

Solution 669778

Submitted on 13 May 2015 by Binbin Qi
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
%% theta = pi/3; f_name = 'sine'; assert(isequal(trig_func_tool(theta,f_name),sin(theta)))

ans = @eval ans = 0.8660

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

ans = @eval ans = 0.5000

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

ans = @eval ans = 1.7321

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

ans = @eval ans = 1.1547

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

ans = @eval ans = 2.0000

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

ans = @eval ans = 0.5774

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

ans = @eval ans = 0.5000

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

ans = @eval ans = 1.5000

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

ans = @eval ans = 0.1340

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

ans = @eval ans = 1.8660

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

ans = @eval ans = 0.2500

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

ans = @eval ans = 0.7500

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

ans = @eval ans = 0.0670

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

ans = @eval ans = 0.9330

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

ans = @eval ans = 1.0000

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

ans = @eval ans = 0.1547

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

ans = @eval ans = 1.0000

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

ans = @eval ans = 0.5878

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

ans = @eval ans = 0.9511

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

ans = @eval ans = 3.0777

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

ans = @eval ans = 1.1547

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

ans = @eval ans = 1.1099

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

ans = @eval ans = 4.0572

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

ans = @eval ans = 0.0051

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

ans = @eval ans = 0.2515

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

ans = @eval ans = 0.1854

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

ans = @eval ans = 1.0951

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

ans = @eval ans = 0.6113

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

ans = @eval ans = 0.2500

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

ans = @eval ans = 0.3803

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

ans = @eval ans = 0.5506

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

ans = @eval ans = 0.0055

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

ans = @eval ans = 0.5080

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

ans = @eval ans = 0.2411