Cody

# Problem 42917. Nth roots of unity

Solution 2602423

Submitted on 23 Jun 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
n = 5; y_correct = -0.467800202134647; assert( abs(your_fcn_name(n)-y_correct) < .0001)

Error using i Too many input arguments. Error in your_fcn_name (line 2) y = sum(exp(2*pi*i(0:n-1)/n)); Error in Test1 (line 3) assert( abs(your_fcn_name(n)-y_correct) < .0001)

2   Fail
n = 50; y_correct = -2.151544927902936 - 0.430301217000093i assert( abs(your_fcn_name(n)-y_correct) < .0001)

y_correct = -2.1515 - 0.4303i

Error using i Too many input arguments. Error in your_fcn_name (line 2) y = sum(exp(2*pi*i(0:n-1)/n)); Error in Test2 (line 3) assert( abs(your_fcn_name(n)-y_correct) < .0001)

3   Fail
n = 7; y_correct = -0.435928596902380 assert( abs(your_fcn_name(n)-y_correct) < .0001)

y_correct = -0.4359

Error using i Too many input arguments. Error in your_fcn_name (line 2) y = sum(exp(2*pi*i(0:n-1)/n)); Error in Test3 (line 3) assert( abs(your_fcn_name(n)-y_correct) < .0001)

4   Fail
n = 70; y_correct = -3.031653804728051 - 0.430301217000095i assert( abs(your_fcn_name(n)-y_correct) < .0001)

y_correct = -3.0317 - 0.4303i

Error using i Too many input arguments. Error in your_fcn_name (line 2) y = sum(exp(2*pi*i(0:n-1)/n)); Error in Test4 (line 3) assert( abs(your_fcn_name(n)-y_correct) < .0001)

### Community Treasure Hunt

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

Start Hunting!