Cody

# Problem 1464. Laguerre polynomials

Solution 564084

Submitted on 23 Jan 2015 by Zikobrelli
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   Pass
%% n = 0; P_correct = [1]/1; assert(isequal(round(laguerrePoly(n)*1),round(P_correct*1)));

P = 0 P = 1 ans = 1

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

P = 0 0 P = 1 0 P = 1 -1 ans = -1 1

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

P = 0 0 0 P = 1 0 0 P = 1 -2 0 P = 1.0000 -2.0000 0.5000 ans = 0.5000 -2.0000 1.0000

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

P = 0 0 0 0 P = 1 0 0 0 P = 1 -3 0 0 P = 1.0000 -3.0000 1.5000 0 P = 1.0000 -3.0000 1.5000 -0.1667 ans = -0.1667 1.5000 -3.0000 1.0000

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

P = 0 0 0 0 0 P = 1 0 0 0 0 P = 1 -4 0 0 0 P = 1 -4 3 0 0 P = 1.0000 -4.0000 3.0000 -0.6667 0 P = 1.0000 -4.0000 3.0000 -0.6667 0.0417 ans = 0.0417 -0.6667 3.0000 -4.0000 1.0000

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

P = 0 0 0 0 0 0 P = 1 0 0 0 0 0 P = 1 -5 0 0 0 0 P = 1 -5 5 0 0 0 P = 1.0000 -5.0000 5.0000 -1.6667 0 0 P = 1.0000 -5.0000 5.0000 -1.6667 0.2083 0 P = 1.0000 -5.0000 5.0000 -1.6667 0.2083 -0.0083 ans = -0.0083 0.2083 -1.6667 5.0000 -5.0000 1.0000

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

P = 0 0 0 0 0 0 0 P = 1 0 0 0 0 0 0 P = 1 -6 0 0 0 0 0 P = 1.0000 -6.0000 7.5000 0 0 0 0 P = 1.0000 -6.0000 7.5000 -3.3333 0 0 0 P = 1.0000 -6.0000 7.5000 -3.3333 0.6250 0 0 P = 1.0000 -6.0000 7.5000 -3.3333 0.6250 -0.0500 0 P = 1.0000 -6.0000 7.5000 -3.3333 0.6250 -0.0500 0.0014 ans = 0.0014 -0.0500 0.6250 -3.3333 7.5000 -6.0000 1.0000

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

P = 0 0 0 0 0 0 0 0 P = 1 0 0 0 0 0 0 0 P = 1 -7 0 0 0 0 0 0 P = 1.0000 -7.0000 10.5000 0 0 0 0 0 P = 1.0000 -7.0000 10.5000 -5.8333 0 0 0 0 P = 1.0000 -7.0000 10.5000 -5.8333 1.4583 0 0 0 P = 1.0000 -7.0000 10.5000 -5.8333 1.4583 -0.1750 0 0 P = 1.0000 -7.0000 10.5000 -5.8333 1.4583 -0.1750 0.0097 0 P = 1.0000 -7.0000 10.5000 -5.8333 1.4583 -0.1750 0.0097 -0.0002 ans = -0.0002 0.0097 -0.1750 1.4583 -5.8333 10.5000 -7.0000 1.0000

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

P = 0 0 0 0 0 0 0 0 0 P = 1 0 0 0 0 0 0 0 0 P = 1 -8 0 0 0 0 0 0 0 P = 1 -8 14 0 0 0 0 0 0 P = 1.0000 -8.0000 14.0000 -9.3333 0 0 0 0 0 P = 1.0000 -8.0000 14.0000 -9.3333 2.9167 0 0 0 0 P = 1.0000 -8.0000 14.0000 -9.3333 2.9167 -0.4667 0 0 0 P = 1.0000 -8.0000 14.0000 -9.3333 2.9167 -0.4667 0.0389 0 0 P = 1.0000 -8.0000 14.0000 -9.3333 2.9167 -0.4667 0.0389 -0.0016 0 P = 1.0000 -8.0000 14.0000 -9.3333 2.9167 -0.4667 0.0389 -0.0016 0.0000 ans = 0.0000 -0.0016 0.0389 -0.4667 2.9167 -9.3333 14.0000 -8.0000 1.0000

11   Pass
%% 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)));

P = 0 0 0 0 0 0 0 0 0 0 P = 1 0 0 0 0 0 0 0 0 0 P = 1 -9 0 0 0 0 0 0 0 0 P = 1 -9 18 0 0 0 0 0 0 0 P = 1 -9 18 -14 0 0 0 0 0 0 P = Columns 1 through 9 1.0000 -9.0000 18.0000 -14.0000 5.2500 0 0 0 0 Column 10 0 P = Columns 1 through 9 1.0000 -9.0000 18.0000 -14.0000 5.2500 -1.0500 0 0 0 Column 10 0 P = Columns 1 through 9 1.0000 -9.0000 18.0000 -14.0000 5.2500 -1.0500 0.1167 0 0 Column 10 0 P = Columns 1 through 9 1.0000 -9.0000 18.0000 -14.0000 5.2500 -1.0500 0.1167 -0.0071 0 Column 10 0 P = Columns 1 through 9 1.0000 -9.0000 18.0000 -14.0000 5.2500 -1.0500 0.1167 -0.0071 0.0002 Column 10 0 P = Columns 1 through 9 1.0000 -9.0000 18.0000 -14.0000 5.2500 -1.0500 0.1167 -0.0071 0.0002 Column 10 -0.0000 ans = Columns 1 through 9 -0.0000 0.0002 -0.0071 0.1167 -1.0500 5.2500 -14.0000 18.0000 -9.0000 Column 10 1.0000

12   Pass
%% 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)));

P = 0 0 0 0 0 0 0 0 0 0 0 P = 1 0 0 0 0 0 0 0 0 0 0 P = 1 -10 0 0 0 0 0 0 0 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 0 0 0 0 0 0 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 0 0 0 0 0 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 0 0 0 0 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 -2.1000 0 0 0 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 -2.1000 0.2917 0 0 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 -2.1000 0.2917 -0.0238 0 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 -2.1000 0.2917 -0.0238 0.0011 Columns 10 through 11 0 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 -2.1000 0.2917 -0.0238 0.0011 Columns 10 through 11 -0.0000 0 P = Columns 1 through 9 1.0000 -10.0000 22.5000 -20.0000 8.7500 -2.1000 0.2917 -0.0238 0.0011 Columns 10 through 11 -0.0000 0.0000 ans = Columns 1 through 9 0.0000 -0.0000 0.0011 -0.0238 0.2917 -2.1000 8.7500 -20.0000 22.5000 Columns 10 through 11 -10.0000 1.0000