Cody

# Problem 1475. Chebyshev polynomials of the 2nd Kind

Solution 3765993

Submitted on 21 Nov 2020 by Luis GONZALEZ
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));

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

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1

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

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0

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

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1

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

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 512 0 -1024 0 672 0 -160 0 10 0 aux0 = 0 0 256 0 -448 0 240 0 -40 0 1 aux1 = 1024 0 -2048 0 1344 0 -320 0 20 0 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 512 0 -1024 0 672 0 -160 0 10 0 aux0 = 0 0 256 0 -448 0 240 0 -40 0 1 aux1 = 1024 0 -2048 0 1344 0 -320 0 20 0 0 P1 = 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux0 = 0 0 512 0 -1024 0 672 0 -160 0 10 0 aux1 = 2048 0 -4608 0 3584 0 -1120 0 120 0 -2 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 512 0 -1024 0 672 0 -160 0 10 0 aux0 = 0 0 256 0 -448 0 240 0 -40 0 1 aux1 = 1024 0 -2048 0 1344 0 -320 0 20 0 0 P1 = 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux0 = 0 0 512 0 -1024 0 672 0 -160 0 10 0 aux1 = 2048 0 -4608 0 3584 0 -1120 0 120 0 -2 0 P1 = 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux0 = 0 0 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux1 = 4096 0 -10240 0 9216 0 -3584 0 560 0 -24 0 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 512 0 -1024 0 672 0 -160 0 10 0 aux0 = 0 0 256 0 -448 0 240 0 -40 0 1 aux1 = 1024 0 -2048 0 1344 0 -320 0 20 0 0 P1 = 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux0 = 0 0 512 0 -1024 0 672 0 -160 0 10 0 aux1 = 2048 0 -4608 0 3584 0 -1120 0 120 0 -2 0 P1 = 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux0 = 0 0 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux1 = 4096 0 -10240 0 9216 0 -3584 0 560 0 -24 0 0 P1 = 4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1 aux0 = 0 0 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux1 = 8192 0 -22528 0 23040 0 -10752 0 2240 0 -168 0 2 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 512 0 -1024 0 672 0 -160 0 10 0 aux0 = 0 0 256 0 -448 0 240 0 -40 0 1 aux1 = 1024 0 -2048 0 1344 0 -320 0 20 0 0 P1 = 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux0 = 0 0 512 0 -1024 0 672 0 -160 0 10 0 aux1 = 2048 0 -4608 0 3584 0 -1120 0 120 0 -2 0 P1 = 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux0 = 0 0 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux1 = 4096 0 -10240 0 9216 0 -3584 0 560 0 -24 0 0 P1 = 4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1 aux0 = 0 0 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux1 = 8192 0 -22528 0 23040 0 -10752 0 2240 0 -168 0 2 0 P1 = 8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 14 0 aux0 = Columns 1 through 14 0 0 4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 Column 15 1 aux1 = Columns 1 through 14 16384 0 -49152 0 56320 0 -30720 0 8064 0 -896 0 28 0 Column 15 0 P1 = 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));

aux0 = 0 0 1 aux1 = 4 0 0 P1 = 4 0 -1 aux0 = 0 0 2 0 aux1 = 8 0 -2 0 P1 = 8 0 -4 0 aux0 = 0 0 4 0 -1 aux1 = 16 0 -8 0 0 P1 = 16 0 -12 0 1 aux0 = 0 0 8 0 -4 0 aux1 = 32 0 -24 0 2 0 P1 = 32 0 -32 0 6 0 aux0 = 0 0 16 0 -12 0 1 aux1 = 64 0 -64 0 12 0 0 P1 = 64 0 -80 0 24 0 -1 aux0 = 0 0 32 0 -32 0 6 0 aux1 = 128 0 -160 0 48 0 -2 0 P1 = 128 0 -192 0 80 0 -8 0 aux0 = 0 0 64 0 -80 0 24 0 -1 aux1 = 256 0 -384 0 160 0 -16 0 0 P1 = 256 0 -448 0 240 0 -40 0 1 aux0 = 0 0 128 0 -192 0 80 0 -8 0 aux1 = 512 0 -896 0 480 0 -80 0 2 0 P1 = 512 0 -1024 0 672 0 -160 0 10 0 aux0 = 0 0 256 0 -448 0 240 0 -40 0 1 aux1 = 1024 0 -2048 0 1344 0 -320 0 20 0 0 P1 = 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux0 = 0 0 512 0 -1024 0 672 0 -160 0 10 0 aux1 = 2048 0 -4608 0 3584 0 -1120 0 120 0 -2 0 P1 = 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux0 = 0 0 1024 0 -2304 0 1792 0 -560 0 60 0 -1 aux1 = 4096 0 -10240 0 9216 0 -3584 0 560 0 -24 0 0 P1 = 4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 1 aux0 = 0 0 2048 0 -5120 0 4608 0 -1792 0 280 0 -12 0 aux1 = 8192 0 -22528 0 23040 0 -10752 0 2240 0 -168 0 2 0 P1 = 8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 14 0 aux0 = Columns 1 through 14 0 0 4096 0 -11264 0 11520 0 -5376 0 1120 0 -84 0 Column 15 1 aux1 = Columns 1 through 14 16384 0 -49152 0 56320 0 -30720 0 8064 0 -896 0 28 0 Column 15 0 P1 = Columns 1 through 14 16384 0 -53248 0 67584 0 -42240 0 13440 0 -2016 0 112 0 Column 15 -1 aux0 = Columns 1 through 14 0 0 8192 0 -24576 0 28160 0 -15360 0 4032 0 -448 0 Columns 15 through 16 14 0 aux1 = Columns 1 through 14 32768 0 -106496 0 135168 0 -84480 0 26880 0 -4032 0 224 0 Columns 15 through 16 -2 0 P1 = Columns 1 through 14 32768 0 -114688 0 159744 0 -112640 0 42240 0 -8064 0 672 0 Columns 15 through 16 -16 0

### Community Treasure Hunt

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

Start Hunting!