Cody

# Problem 1475. Chebyshev polynomials of the 2nd Kind

Solution 1181823

Submitted on 5 May 2017 by arvid Martens
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
user_solution = fileread('chebyshev2ndKindPoly.m'); assert(isempty(strfind(user_solution,'regexp'))); assert(isempty(strfind(user_solution,'2str'))); assert(isempty(strfind(user_solution,'str2'))); assert(isempty(strfind(user_solution,'interp'))); assert(isempty(strfind(user_solution,'printf'))); assert(isempty(strfind(user_solution,'assert')));

2   Pass
n = 0; P_correct = [1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

3   Pass
n = 1; P_correct = [2 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 2 0

4   Pass
n = 2; P_correct = [4 0 -1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 4 0 -1

5   Pass
n = 3; P_correct = [8 0 -4 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 8 0 -4 0

6   Pass
n = 4; P_correct = [16 0 -12 0 1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 16 0 -12 0 1

7   Pass
n = 5; P_correct = [32 0 -32 0 6 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 32 0 -32 0 6 0

8   Pass
n = 6; P_correct = [64 0 -80 0 24 0 -1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 64 0 -80 0 24 0 -1

9   Pass
n = 7; P_correct = [128 0 -192 0 80 0 -8 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 128 0 -192 0 80 0 -8 0

10   Pass
n = 8; P_correct = [256 0 -448 0 240 0 -40 0 1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 256 0 -448 0 240 0 -40 0 1

11   Pass
n = 9; P_correct = [512 0 -1024 0 672 0 -160 0 10 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 512 0 -1024 0 672 0 -160 0 10 0

12   Pass
n = 10; P_correct = [1024 0 -2304 0 1792 0 -560 0 60 0 -1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 1024 0 -2304 0 1792 0 -560 0 60 0 -1

13   Pass
n = 11; P_correct = [2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0

14   Pass
n = 12; P_correct = [4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1

15   Pass
n = 13; P_correct = [8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 14 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = 8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 14 0

16   Pass
n = 14; P_correct = [16384 0 -53248 0 67584 0 -42240 0 13440 0 -2016 0 112 0 -1]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = Columns 1 through 14 16384 0 -53248 0 67584 0 -42240 0 13440 0 -2016 0 112 0 Column 15 -1

17   Pass
n = 15; P_correct = [32768 0 -114688 0 159744 0 -112640 0 42240 0 -8064 0 672 0 -16 0]; assert(isequal(chebyshev2ndKindPoly(n),P_correct));

P = Columns 1 through 14 32768 0 -114688 0 159744 0 -112640 0 42240 0 -8064 0 672 0 Columns 15 through 16 -16 0