Cody

Problem 1474. Chebyshev polynomials of the 1st Kind

Solution 1814114

Submitted on 13 May 2019 by ilo fontana
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('chebyshev1stKindPoly.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(chebyshev1stKindPoly(n),P_correct));

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

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

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

6   Pass
n = 4; P_correct = [8 0 -8 0 1]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

7   Pass
n = 5; P_correct = [16 0 -20 0 5 0]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

8   Pass
n = 6; P_correct = [32 0 -48 0 18 0 -1]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

9   Pass
n = 7; P_correct = [64 0 -112 0 56 0 -7 0]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

10   Pass
n = 8; P_correct = [128 0 -256 0 160 0 -32 0 1]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

11   Pass
n = 9; P_correct = [256 0 -576 0 432 0 -120 0 9 0]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

12   Pass
n = 10; P_correct = [512 0 -1280 0 1120 0 -400 0 50 0 -1]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

13   Pass
n = 11; P_correct = [1024 0 -2816 0 2816 0 -1232 0 220 0 -11 0]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

14   Pass
n = 12; P_correct = [2048 0 -6144 0 6912 0 -3584 0 840 0 -72 0 1]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

15   Pass
n = 13; P_correct = [4096 0 -13312 0 16640 0 -9984 0 2912 0 -364 0 13 0]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

16   Pass
n = 14; P_correct = [8192 0 -28672 0 39424 0 -26880 0 9408 0 -1568 0 98 0 -1]; assert(isequal(chebyshev1stKindPoly(n),P_correct));

17   Pass
n = 15; P_correct = [16384 0 -61440 0 92160 0 -70400 0 28800 0 -6048 0 560 0 -15 0]; assert(isequal(chebyshev1stKindPoly(n),P_correct));