Calculate taylor series in Wolfram Mathematica or Maple

1k Views Asked by At

I want to calc the Taylor Series Expansion of $Â(z) = z\sum_{j\ge0}(e^z - e^{(1 - 2^{-j})z})$ at $z=0$, but I can't figure out a way to handle the infinite summation.

When I ask Maple

taylor(z*(Sum(e^z - e^((1-2^(-j))*z), j = 0 .. infinite)), z = 0, 8)

it gives me

$$\left(\sum_{j=0}^\inf\left(-(1-2^{-j})ln(e) + ln(e)\right)\right)z^2 + \left(\sum_{j=0}^\inf\left(-\frac{1}{2}(1-2^{-j})^2ln(e)^2 + \frac{1}{2}ln(e)^2\right)\right)z^3 + ...$$

which is not what I expected. Before someone ask, I didn't really know what to expect of this, but I was kinda hoping for values, not summations. Is it possible to evaluate those infinite summations?

3

There are 3 best solutions below

0
On

By definition, the taylor series expansion of some function around a some point consists of infinite series summations approximating the function around (i.e. "very close" to ..) the point at which the expansion is calculated. Such expansions are convergent close to the point of expansion. This is why we speak of a "radius of convergence" for such series expansions.

What you can do to compute the values of such series (and thus to approximate the value of the initial function) is the following: Choose a value of $z$ with "small" modulus (close to zero, i.e. inside the radius of convergence) and sum the first few terms of the series. Ignore the rest. The smaller the value of the modulus, the fewer the necessary terms of summation. You can experiment yourself, on how many terms of the series are needed in order for the sum to stabilize (depending on the accuracy you need).

6
On

Here's what you can do:

$$e^z - e^{(1-2^{-j})z} = e^z \left( 1 - e^{-2^{-j} z} \right) = -e^z \sum_{k=1}^\infty \frac{(-2^{-j})^k}{k!} z^k,$$ so we have $$\hat A(z) = - z e^z \sum_{j=0}^\infty \sum_{k=1}^\infty \frac{(-2^{-j})^k}{k!} z^k = -z e^z \sum_{k=1}^\infty \frac{z^k}{k!} \sum_{j=0}^\infty ((-2)^k)^{-j} = -ze^z \sum_{k=1}^\infty \frac{(-2z)^k}{(2^k - 1)k!}.$$ Now we need to expand $e^z$ as a series and multiply the resulting two power series; this can be achieved in Mathematica as follows:

S[n_, z_] : = -z Series[Exp[z], {z, 0, n}] Sum[(-2 z)^k/((2^k - 1) k!), {k, 1, n+1}]

which will give output that is accurate to at least $O(z^{n})$ if I have done things correctly. For example, S[10, z] gives the output

$$2 z^2+\frac{4 z^3}{3}+\frac{11 z^4}{21}+\frac{46 z^5}{315}+\frac{247 z^6}{7812}+\frac{197 z^7}{35154} \\ +\frac{75133 z^8}{89291160}+\frac{416107 z^9}{3794874300}+\frac{1175130769 z^{10}}{93080676830400} \\ +\frac{222224099 z^{11}}{170647907522400}+\frac{170006814269 z^{12}}{1397265066793411200}+O\left(z^{13}\right)$$

and we can evaluate this for specific $z$ by first using Normal[] to remove the $O(z^{13})$ term.

I should also point out that your Maple syntax could be causing a problem, because it does not appear that Maple recognizes e^z as $\exp(z)$, since your output has the term ln(e). You should instead specify the function as exp(z); I suspect you will obtain results in agreement with mine.

0
On

Without giving much thought to the math, in Maple you could try this crude approach:

orig := z*Sum(exp(z)-exp((1-2^(-j))*z),j=0..infinity):

solA := sort(value(combine(convert(taylor(orig,z=0,10),polynom)))):

lprint(solA);

  416107/3794874300*z^9+75133/89291160*z^8+197/35154*z^7
  +247/7812*z^6+46/315*z^5+11/21*z^4+4/3*z^3+2*z^2

solB := sort(expand(value(
               z*Sum(convert(taylor(exp(z)-exp((1-2^(-j))*z),z=0,10),
                             polynom),j=0..infinity)))):

lprint(solB);

  1175130769/93080676830400*z^10
  +416107/3794874300*z^9+75133/89291160*z^8+197/35154*z^7
  +247/7812*z^6+46/315*z^5+11/21*z^4+4/3*z^3+2*z^2

plot([solA-orig], z=-1.0 .. 1.0);
plot([solB-orig], z=-1.0 .. 1.0);