Cody

Problem 1464. Laguerre polynomials

Solution 1938084

Submitted on 16 Sep 2019
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('laguerrePoly.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   Fail
n = 0; P_correct = [1]/1; assert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));

P = -1 1

Assertion failed.

3   Pass
n = 1; P_correct = [-1 1]/1; assert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));

P = -1 1

4   Fail
n = 2; P_correct = [1 -4 2]/2; assert(isequal(round(laguerrePoly(n)*2),round(P_correct*2)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} P = 0.5000 -1.5000 0.5000

Assertion failed.

5   Fail
n = 3; P_correct = [-1 9 -18 6]/6; assert(isequal(round(laguerrePoly(n)*6),round(P_correct*6)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} P = -0.1667 1.1667 -1.5000 0

Assertion failed.

6   Fail
n = 4; P_correct = [1 -16 72 -96 24]/24; assert(isequal(round(laguerrePoly(n)*24),round(P_correct*24)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} P = 0.0417 -0.5417 1.7500 -1.1250 -0.3750

Assertion failed.

7   Fail
n = 5; P_correct = [-1 25 -200 600 -600 120]/120; assert(isequal(round(laguerrePoly(n)*120),round(P_correct*120)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} c = 1×6 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} P = -0.0083 0.1750 -1.0833 2.0917 -0.5250 -0.6000

Assertion failed.

8   Fail
n = 6; P_correct = [1 -36 450 -2400 5400 -4320 720]/720; assert(isequal(round(laguerrePoly(n)*720),round(P_correct*720)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} c = 1×6 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} c = 1×7 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} P = 0.0014 -0.0431 0.4375 -1.7028 2.1153 0.1625 -0.6875

Assertion failed.

9   Fail
n = 7; P_correct = [-1 49 -882 7350 -29400 52920 -35280 5040]/5040; assert(isequal(round(laguerrePoly(n)*5040),round(P_correct*5040)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} c = 1×6 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} c = 1×7 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} c = 1×8 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} P = -0.0002 0.0085 -0.1292 0.8433 -2.2927 1.8101 0.8268 -0.6643

Assertion failed.

10   Fail
n = 8; P_correct = [1 -64 1568 -18816 117600 -376320 564480 -322560 40320]/40320; assert(isequal(round(laguerrePoly(n)*40320),round(P_correct*40320)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} c = 1×6 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} c = 1×7 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} c = 1×8 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} c = 1×9 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} {1×9 double} P = 0.0000 -0.0014 0.0299 -0.2938 1.3795 -2.7485 1.2135 1.3877 -0.5609

Assertion failed.

11   Fail
n = 9; P_correct = [-1 81 -2592 42336 -381024 1905120 -5080320 6531840 -3265920 362880]/362880; assert(isequal(round(laguerrePoly(n)*362880),round(P_correct*362880)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} c = 1×6 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} c = 1×7 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} c = 1×8 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} c = 1×9 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} {1×9 double} c = 1×10 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} {1×9 double} {1×10 double} P = -0.0000 0.0002 -0.0057 0.0781 -0.5607 2.0082 -2.9831 0.3941 1.7945 -0.4067

Assertion failed.

12   Fail
n = 10; P_correct = [1 -100 4050 -86400 1058400 -7620480 31752000 -72576000 81648000 -36288000 3628800]/3628800; assert(isequal(round(laguerrePoly(n)*3628800),round(P_correct*3628800)));

c = 1×3 cell array {[1]} {1×2 double} {1×3 double} c = 1×4 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} c = 1×5 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} c = 1×6 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} c = 1×7 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} c = 1×8 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} c = 1×9 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} {1×9 double} c = 1×10 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} {1×9 double} {1×10 double} c = 1×11 cell array {[1]} {1×2 double} {1×3 double} {1×4 double} {1×5 double} {1×6 double} {1×7 double} {1×8 double} {1×9 double} {1×10 double} {1×11 double} P = 0.0000 -0.0000 0.0009 -0.0167 0.1699 -0.9457 2.6716 -2.9354 -0.5622 2.0218 -0.2273

Assertion failed.