Cody

Problem 43564. Calculate sin(x) without sin(x)

Solution 3217933

Submitted on 15 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
x = -pi/2; y_correct = sin(x); assert(abs(my_func(x)-y_correct)<0.0001)

Unrecognized function or variable 'z'. Error in my_func (line 2) y = (exp(i*z) - exp(-i*z))/(2i)

2   Fail
x = rand(1)*2*pi; y_correct = sin(x); assert(abs(my_func(x)-y_correct)<0.0001)

Unrecognized function or variable 'z'. Error in my_func (line 2) y = (exp(i*z) - exp(-i*z))/(2i)

3   Fail
assessFunctionAbsence({'cos', 'sin'}, 'FileName', 'my_func.m');

Unrecognized function or variable 'z'. Error in my_func (line 2) y = (exp(i*z) - exp(-i*z))/(2i)

Suggested Problems

More from this Author5

Community Treasure Hunt

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

Start Hunting!