Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Iterability of exp(x)-1
#20
I am able to compute them so fast because of 4 secrets: Smile
  1. I have Mathematica.
  2. I know that (IDM+Interpolation) is faster than (PDM+Powers)
  3. I use the Double-Binomial instead of Lagrange Interpolation.
  4. I use a custom IDM method.
With (PDM+Powers), you are effectively computing the interpolation of a triangular matrix, which is interpolations when we only need interpolations. This indicated to me that the IDM method was a better way to go. After I realized that, it was only a matter of comparing the timings of Lagrange Interpolation vs. Double-Binomial expansion to see which was faster.

First, I will start with the straight-forward Mathematica code:

Code:
size = 10;

coeff = Join[{0}, Map[InterpolatingPolynomial[#, t] &,
  Transpose@Table[Series[Nest[(Exp[#] - 1) &, x, k],
  {x, 0, size}][[3]], {k, 1, size}]]];

TableForm@Expand@coeff

and now for the highly-optimized Mathematica code:

Code:
(* This is not built-in for some reason... *)
Unprotect[Binomial];
Binomial[t_, k_Integer?Positive] := Product[t - j, {j, 0, k - 1}]/k!;
Protect[Binomial];

(* This assumes x0 == 0 *)
ParabolicIDM[expr_, {x_, 0, size_}] := Module[{ret, ser},
  ret = {};
  ser = Series[x, {x, 0, size}];
  Do[
    ser = Series[expr /. x -> Normal[ser], {x, 0, size}];
    AppendTo[ret, Join[{0}, ser[[3]]]],
  {size + 1}];
  Join[{UnitVector[size + 1, 2]}, ret]
];

(* Then use the custom IDM as follows *)
size = 50;
matrix = ParabolicIDM[Exp[x] - 1, {x, 0, size}];
coeff = Table[Sum[(-1)^(n - k - 1) matrix[[k + 1, n + 1]]
  Binomial[t, k] Binomial[t - k - 1, n - k - 1],
  {k, 0, n - 1}], {n, 0, size}];

(* Then do what you like to 'coeff', for example: *)
TableForm@Expand@coeff[[1 ;; 20]]

Using this code, I find that I can get 100 coefficients in under 25 sec, and 150 coefficients in under 2 mins. As you can see, the custom IDM method is truncating the series at every step, so you're not saving the iteration of a 50-degree polynomial composed with a 50-degree polynomial which otherwise would be 2500-degree polynomial only after the second iterate. This "chopping" keeps the iterations within the size you are interested in, so you aren't calculating things that you don't care about.

Andrew Robbins
Reply


Messages In This Thread
Iterability of exp(x)-1 - by bo198214 - 08/11/2007, 09:33 PM
RE: Iterability of exp(x)-1 - by Daniel - 08/11/2007, 09:49 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/11/2007, 11:42 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/12/2007, 09:07 AM
RE: Iterability of exp(x)-1 - by jaydfox - 08/12/2007, 04:41 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/13/2007, 08:54 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/11/2007, 10:25 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/13/2007, 09:06 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/13/2007, 09:13 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/13/2007, 09:16 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/13/2007, 09:33 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/13/2007, 10:00 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/13/2007, 10:05 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/13/2007, 10:11 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/13/2007, 10:22 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/13/2007, 10:00 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/13/2007, 10:29 PM
RE: Iterability of exp(x)-1 - by andydude - 08/13/2007, 10:30 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/13/2007, 10:39 PM
RE: Iterability of exp(x)-1 - by andydude - 08/15/2007, 08:36 AM
RE: Iterability of exp(x)-1 - by bo198214 - 08/15/2007, 09:21 AM
RE: Iterability of exp(x)-1 - by andydude - 08/15/2007, 08:40 PM
RE: Iterability of exp(x)-1 - by jaydfox - 08/15/2007, 08:54 AM
RE: Iterability of exp(x)-1 - by jaydfox - 08/15/2007, 08:53 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/15/2007, 09:13 PM
RE: Iterability of exp(x)-1 - by bo198214 - 08/20/2007, 04:14 PM
RE: Iterability of exp(x)-1 - by andydude - 09/05/2007, 08:15 PM
RE: Iterability of exp(x)-1 - by bo198214 - 09/07/2007, 02:45 PM
RE: Iterability of exp(x)-1 - by Gottfried - 03/15/2008, 09:13 AM
RE: Iterability of exp(x)-1 - by bo198214 - 03/15/2008, 01:14 PM
RE: Iterability of exp(x)-1 - by Gottfried - 03/15/2008, 08:25 PM
RE: Iterability of exp(x)-1 - by Gottfried - 03/18/2008, 10:14 AM



Users browsing this thread: 1 Guest(s)