Maclaurin Expansion for $e^{e^{z}}$ at $z=0$

If you omit all terms with $x^6$ or higher you can compute $$e^{e^x}= e^{1+x+x^2/2+x^3/6+x^4/24+x^5/120}$$ $$=e^{1}e^{x} e^{x^2/2} e^{x^3/6} e^{x^4/24}e ^{x^5/120}$$ $$=e(1+x+\tfrac{1}{2}x^2+\tfrac{1}{6}x^3+\tfrac{1}{24}x^4+\tfrac{1}{120}x^5) (1+\tfrac{1}{2}x^2+\tfrac{1}{8}x^4) (1+\tfrac{1}{6}x^3) (1+\tfrac{1}{24}x^4) (1+\tfrac{1}{120}x^5)$$ Distribute, omit $x^6\dots$ and get the Maclaurin expansion $$e^{e^x}=e(1+x+x^2+\tfrac{5}{6}x^3+\tfrac{5}{8}x^4+\tfrac{13}{30}x^5)$$


Alternatively you could calculate the expansion this way:

Let $f(z)=e^{e^z}$

Then $\log (f(z))=e^z$

Differentiating with respect to $z$ gives: $\frac 1{f(z)} f'(z)=e^z$ (using chain rule)

Differentiating again gives: $-\frac 1{f^2}f' f'+\frac 1{f} f''=e^z \Rightarrow -\frac 1{f^2}(f')^2+\frac 1{f} f''=e^z $ (using product rule and chain rule)

Can you continue this?

Substituting $z=0$ into the expressions above: $f(0)=e^{e^0}=e^1=e$

$\frac 1{f(0)} f'(0)=e^0 \Rightarrow \frac 1e f'(0)=1 \Rightarrow f'(0)=e$

$-\frac 1{f(0)^2}(f'(0))^2+\frac 1{f(0)} f''(0)=e^0 \Rightarrow -\frac 1{e^2}e^2+\frac 1{e} f''(0)=1 \Rightarrow -1+\frac 1{e} f''(0)=1 \Rightarrow \frac 1{e} f''(0)=2 \Rightarrow f''(0)=2e$

Maclaurin series is $f(0) + f'(0)z + \frac 1{2!} f''(0)z^2 + ...$

Maclaurin series is $e + ez + \frac 1{2} 2ez^2 + ... = e + ez + ez^2 + ... $


Looking at the successive derivatives of $e^{e^z}$, you notice that they are of the form

$$e^{e^z}P(e^z)$$ where $P$ is a polynomial.

Indeed,

$$\left(e^{e^z}P(e^z)\right)'=e^{e^z}e^zP(e^z)+e^{e^z}e^zP'(e^z)=e^{e^z}e^z(P(e^z)+P'(e^z)=e^{e^z}Q(e^z).$$

Thus the successive polynomials follow the recurrence

$$P_{k+1}(x)=x(P_k(x)+P'_k(x)),$$ i.e. for the coefficients with $d\le k$,

$$p_{k+1,d+1}=p_{k,d-1}+(d+1)p_{k,d},\\p_{k+1,d+1}=1$$ giving

$$1\\x\\x^2+x\\x^3+3x^2+x\\x^4+6x^3+7x^2+x\\x^5+10x^4+25x^3+15x^2+x\\ x^6+15x^5+65x^4+90x^3+31x^2+x\\\cdots$$

As they are evaluated at $e^0=1$, the final Taylor expansion is obtained by summing the coefficients,

$$e\left(1+x+\frac22x^2+\frac5{3!}x^3+\frac{15}{4!}x^4+\frac{52}{5!}x^5+\frac{203}{6!}x^6\cdots\right)$$


P= [1]
print 1
for k in range(20):
    Q= [1]
    for d in range(1, len(P)):
        Q.append(P[d - 1] + (d + 1) * P[d])
    Q.append(0)
    P= Q
    print sum(Q)

1
1
2
5
15
52
203
877
4140
21147
115975
678570
4213597
27644437
190899322
1382958545
10480142147
82864869804
682076806159
5832742205057
51724158235372