3 deleted 10 characters in body
source | link

I would also suggest to use pure functions here:

CharlierC[0] = 1 &;
CharlierC[1] = Evaluate[#2#2 - #1]#1 &;
CharlierC[n_Integer] := (CharlierC[n] = 
    Evaluate[
      Expand[(#2 - #1 - n + 1) CharlierC[n - 1][#1, #2] - #1 (n - 
           1) CharlierC[n - 2][#1, #2]]] &);
CharlierC[20][a, x] // AbsoluteTiming

(* ==> {0.0312414, 
 a^20 - 121645100408832000 x - 128047474114560000 a x - 
  67580611338240000 a^2 x - 23851980472320000 a^3 x - 
  6335682312960000 a^4 x - 1351612226764800 a^5 x - 
  241359326208000 a^6 x - 37132204032000 a^7 x - 
  5028319296000 a^8 x - 609493248000 a^9 x - 67044257280 a^10 x - 
  6772147200 a^11 x - 634888800 a^12 x - ...
*)

I haven't made comparisons, but this seems to be faster.

I would also suggest to use pure functions here:

CharlierC[0] = 1 &;
CharlierC[1] = Evaluate[#2 - #1] &;
CharlierC[n_Integer] := (CharlierC[n] = 
    Evaluate[
      Expand[(#2 - #1 - n + 1) CharlierC[n - 1][#1, #2] - #1 (n - 
           1) CharlierC[n - 2][#1, #2]]] &);
CharlierC[20][a, x] // AbsoluteTiming

(* ==> {0.0312414, 
 a^20 - 121645100408832000 x - 128047474114560000 a x - 
  67580611338240000 a^2 x - 23851980472320000 a^3 x - 
  6335682312960000 a^4 x - 1351612226764800 a^5 x - 
  241359326208000 a^6 x - 37132204032000 a^7 x - 
  5028319296000 a^8 x - 609493248000 a^9 x - 67044257280 a^10 x - 
  6772147200 a^11 x - 634888800 a^12 x - ...
*)

I haven't made comparisons, but this seems to be faster.

I would also suggest to use pure functions here:

CharlierC[0] = 1 &;
CharlierC[1] = #2 - #1 &;
CharlierC[n_Integer] := (CharlierC[n] = 
    Evaluate[
      Expand[(#2 - #1 - n + 1) CharlierC[n - 1][#1, #2] - #1 (n - 
           1) CharlierC[n - 2][#1, #2]]] &);
CharlierC[20][a, x] // AbsoluteTiming

(* ==> {0.0312414, 
 a^20 - 121645100408832000 x - 128047474114560000 a x - 
  67580611338240000 a^2 x - 23851980472320000 a^3 x - 
  6335682312960000 a^4 x - 1351612226764800 a^5 x - 
  241359326208000 a^6 x - 37132204032000 a^7 x - 
  5028319296000 a^8 x - 609493248000 a^9 x - 67044257280 a^10 x - 
  6772147200 a^11 x - 634888800 a^12 x - ...
*)

I haven't made comparisons, but this seems to be faster.

2 deleted 113 characters in body
source | link

I would also suggest to use pure functions here:

CharlierC[0, a_]CharlierC[0] = 1 &;
CharlierC[1, a_]CharlierC[1] = Evaluate[#Evaluate[#2 - a]#1] &;
CharlierC[n_Integer, a_]CharlierC[n_Integer] := (CharlierC[n, a]CharlierC[n] = 
    Evaluate[
      Expand[(##2 - a#1 - n + 1) CharlierC[n - 11][#1, a]@##2] - 
  #1 (n -  
        a (n - 1) CharlierC[n - 22][#1, a]@#]
    ]#2]]] &);
CharlierC[20CharlierC[20][a, 1][x]x] // AbsoluteTiming

(*==>* ==> {0.0312414, 1
 a^20 - 349096664728623336121645100408832000 x +- 1218507112218768721128047474114560000 x^2a x - 
  1849525745917903666 x^3 +67580611338240000 1646873959921840191a^2 x^4x - 
  974337429086225464 x^5 +23851980472320000 409992375276802318a^3 x^6x - 
  127973408405111892 x^7 +6335682312960000 30457268979047221a^4 x^8x - 
  56289265709877201351612226764800 x^9a^5 +x 817364855067111- x^10 
 - 93868560860438241359326208000 x^11a^6 +x 
 - 37132204032000 8543590495141a^7 x^12x - 614833445760 
 x^13 +5028319296000 34731611830a^8 x^14x - 
 609493248000 a^9 1519659444x x^15- +67044257280 50387031a^10 x^16x - 1222080 
 x^17 +6772147200 20425a^11 x^18x - 
 634888800 210a^12 x^19x +- x^20}...
*)

I haven't made comparisons, but this seems to be faster.

I would also suggest to use pure functions here:

CharlierC[0, a_] = 1 &;
CharlierC[1, a_] = Evaluate[# - a] &;
CharlierC[n_Integer, a_] := (CharlierC[n, a] = 
    Evaluate[
      Expand[(# - a - n + 1) CharlierC[n - 1, a]@# - 
             a (n - 1) CharlierC[n - 2, a]@#]
    ] &);
CharlierC[20, 1][x] // AbsoluteTiming

(*==> {0., 1 - 349096664728623336 x + 1218507112218768721 x^2 - 
  1849525745917903666 x^3 + 1646873959921840191 x^4 - 
  974337429086225464 x^5 + 409992375276802318 x^6 - 
  127973408405111892 x^7 + 30457268979047221 x^8 - 
  5628926570987720 x^9 + 817364855067111 x^10 - 93868560860438 x^11 + 
   8543590495141 x^12 - 614833445760 x^13 + 34731611830 x^14 - 
   1519659444 x^15 + 50387031 x^16 - 1222080 x^17 + 20425 x^18 - 
  210 x^19 + x^20}*)

I haven't made comparisons, but this seems to be faster.

I would also suggest to use pure functions here:

CharlierC[0] = 1 &;
CharlierC[1] = Evaluate[#2 - #1] &;
CharlierC[n_Integer] := (CharlierC[n] = 
    Evaluate[
      Expand[(#2 - #1 - n + 1) CharlierC[n - 1][#1, #2] - #1 (n -  
           1) CharlierC[n - 2][#1, #2]]] &);
CharlierC[20][a, x] // AbsoluteTiming

(* ==> {0.0312414, 
 a^20 - 121645100408832000 x - 128047474114560000 a x - 
  67580611338240000 a^2 x - 23851980472320000 a^3 x - 
  6335682312960000 a^4 x - 1351612226764800 a^5 x -  
  241359326208000 a^6 x - 37132204032000 a^7 x -  
  5028319296000 a^8 x - 609493248000 a^9 x - 67044257280 a^10 x -  
  6772147200 a^11 x - 634888800 a^12 x - ...
*)

I haven't made comparisons, but this seems to be faster.

1
source | link

I would also suggest to use pure functions here:

CharlierC[0, a_] = 1 &;
CharlierC[1, a_] = Evaluate[# - a] &;
CharlierC[n_Integer, a_] := (CharlierC[n, a] = 
    Evaluate[
      Expand[(# - a - n + 1) CharlierC[n - 1, a]@# - 
             a (n - 1) CharlierC[n - 2, a]@#]
    ] &);
CharlierC[20, 1][x] // AbsoluteTiming

(*==> {0., 1 - 349096664728623336 x + 1218507112218768721 x^2 - 
  1849525745917903666 x^3 + 1646873959921840191 x^4 - 
  974337429086225464 x^5 + 409992375276802318 x^6 - 
  127973408405111892 x^7 + 30457268979047221 x^8 - 
  5628926570987720 x^9 + 817364855067111 x^10 - 93868560860438 x^11 + 
  8543590495141 x^12 - 614833445760 x^13 + 34731611830 x^14 - 
  1519659444 x^15 + 50387031 x^16 - 1222080 x^17 + 20425 x^18 - 
  210 x^19 + x^20}*)

I haven't made comparisons, but this seems to be faster.