Cody

Solution 2238935

Submitted on 27 Apr 2020
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('genLaguerrePoly.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; a = 0; P_correct = [1]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test2 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

3   Fail
n = 1; a = 0; P_correct = [-1 1]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test3 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

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

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test4 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

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

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test5 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

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

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test6 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

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

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test7 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

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

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test8 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

9   Fail
n = 0; a = 1; P_correct = [1]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test9 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

10   Fail
n = 1; a = 1; P_correct = [-1 2]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test10 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

11   Fail
n = 2; a = 1; P_correct = [1 -6 6]/2; assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test11 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

12   Fail
n = 3; a = 1; P_correct = [-1 12 -36 24]/6; assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test12 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

13   Fail
n = 4; a = 1; P_correct = [1 -20 120 -240 120]/24; assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test13 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

14   Fail
n = 5; a = 1; P_correct = [-1 30 -300 1200 -1800 720]/120; assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test14 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

15   Fail
n = 6; a = 1; P_correct = [1 -42 630 -4200 12600 -15120 5040]/720; assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test15 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

16   Fail
n = 0; a = 2; P_correct = [1]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test16 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

17   Fail
n = 1; a = 2; P_correct = [-1 3]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test17 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

18   Fail
n = 2; a = 2; P_correct = [1 -8 12]/2; assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test18 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

19   Fail
n = 3; a = 2; P_correct = [-1 15 -60 60]/6; assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test19 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

20   Fail
n = 4; a = 2; P_correct = [1 -24 180 -480 360]/24; assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test20 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

21   Fail
n = 5; a = 2; P_correct = [-1 35 -420 2100 -4200 2520]/120; assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test21 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

22   Fail
n = 6; a = 2; P_correct = [1 -48 840 -6720 25200 -40320 20160]/720; assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test22 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

23   Fail
n = 0; a = 3; P_correct = [1]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test23 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

24   Fail
n = 1; a = 3; P_correct = [-1 4]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test24 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

25   Fail
n = 2; a = 3; P_correct = [1 -10 20]/2; assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test25 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

26   Fail
n = 3; a = 3; P_correct = [-1 18 -90 120]/6; assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test26 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

27   Fail
n = 4; a = 3; P_correct = [1 -28 252 -840 840]/24; assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test27 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

28   Fail
n = 5; a = 3; P_correct = [-1 40 -560 3360 -8400 6720]/120; assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test28 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

29   Fail
n = 6; a = 3; P_correct = [1 -54 1080 -10080 45360 -90720 60480]/720; assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test29 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

30   Fail
n = 0; a = 4; P_correct = [1]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test30 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

31   Fail
n = 1; a = 4; P_correct = [-1 5]/1; assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test31 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*1),round(P_correct*1)));

32   Fail
n = 2; a = 4; P_correct = [1 -12 30]/2; assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test32 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*2),round(P_correct*2)));

33   Fail
n = 3; a = 4; P_correct = [-1 21 -126 210]/6; assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test33 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*6),round(P_correct*6)));

34   Fail
n = 4; a = 4; P_correct = [1 -32 336 -1344 1680]/24; assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test34 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*24),round(P_correct*24)));

35   Fail
n = 5; a = 4; P_correct = [-1 45 -720 5040 -15120 15120]/120; assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test35 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*120),round(P_correct*120)));

36   Fail
n = 6; a = 4; P_correct = [1 -60 1350 -14400 75600 -181440 151200]/720; assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));

Error using nchoosek (line 29) The second input has to be a non-negative integer. Error in genLaguerrePoly>@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k) (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in genLaguerrePoly (line 2) fliplr(arrayfun(@(k)nchoosek(n+a,k-j)*(-1)^k/factorial(k),0:n)); Error in Test36 (line 4) assert(isequal(round(genLaguerrePoly(n,a)*720),round(P_correct*720)));