Cody

# Problem 1465. Generalized Laguerre polynomials

Solution 236871

Submitted on 27 Apr 2013 by Claudio Gelmi
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')));

``` ```

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

``` ans = 1 ```

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

``` ans = -1 1 ```

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

``` ans = 0.5000 -2.0000 1.0000 ```

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

``` ans = -0.1667 1.5000 -3.0000 1.0000 ```

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

``` ans = 0.0417 -0.6667 3.0000 -4.0000 1.0000 ```

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

``` ans = -0.0083 0.2083 -1.6667 5.0000 -5.0000 1.0000 ```

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

``` ans = 0.0014 -0.0500 0.6250 -3.3333 7.5000 -6.0000 1.0000 ```

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

``` ans = 1 ```

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

``` ans = -1 2 ```

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

``` ans = 0.5000 -3.0000 3.0000 ```

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

``` ans = -0.1667 2.0000 -6.0000 4.0000 ```

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

``` ans = 0.0417 -0.8333 5.0000 -10.0000 5.0000 ```

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

``` ans = -0.0083 0.2500 -2.5000 10.0000 -15.0000 6.0000 ```

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

``` ans = 0.0014 -0.0583 0.8750 -5.8333 17.5000 -21.0000 7.0000 ```

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

``` ans = 1 ```

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

``` ans = -1 3 ```

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

``` ans = 0.5000 -4.0000 6.0000 ```

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

``` ans = -0.1667 2.5000 -10.0000 10.0000 ```

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

``` ans = 0.0417 -1.0000 7.5000 -20.0000 15.0000 ```

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

``` ans = -0.0083 0.2917 -3.5000 17.5000 -35.0000 21.0000 ```

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

``` ans = 0.0014 -0.0667 1.1667 -9.3333 35.0000 -56.0000 28.0000 ```

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

``` ans = 1 ```

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

``` ans = -1 4 ```

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

``` ans = 0.5000 -5.0000 10.0000 ```

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

``` ans = -0.1667 3.0000 -15.0000 20.0000 ```

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

``` ans = 0.0417 -1.1667 10.5000 -35.0000 35.0000 ```

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

``` ans = -0.0083 0.3333 -4.6667 28.0000 -70.0000 56.0000 ```

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

``` ans = 0.0014 -0.0750 1.5000 -14.0000 63.0000 -126.0000 84.0000 ```

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

``` ans = 1 ```

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

``` ans = -1 5 ```

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

``` ans = 0.5000 -6.0000 15.0000 ```

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

``` ans = -0.1667 3.5000 -21.0000 35.0000 ```

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

``` ans = 0.0417 -1.3333 14.0000 -56.0000 70.0000 ```

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

``` ans = -0.0083 0.3750 -6.0000 42.0000 -126.0000 126.0000 ```

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

``` ans = 0.0014 -0.0833 1.8750 -20.0000 105.0000 -252.0000 210.0000 ```