3
$\begingroup$

This may be more math related than Mathematica related, but I thought this might be of interest to the group.

I'm trying to work with some Taylor Series approximations of functions that are ultimately exponentiated. I've noticed that the order which I apply Normal and Exp affects the output, but I don't understand why.

Here's an example

Series[-q (c[x1]  - c[x2]), {x2, x1, 1}]
Exp[%] // Normal // Simplify
(Exp[%% // Normal]) // Simplify

The output is

SeriesData[x2, x1, {q*Derivative[1][c][x1]}, 1, 2, 1]
1 + q*(-x1 + x2)*Derivative[1][c][x1]
E^(q*(-x1 + x2)*Derivative[1][c][x1])

Assuming that we are dealing with real functions and parameters, it seems like the Exp[%% // Normal] would be more accurate since we can derive the Exp[%] // Normal result from it when q is close to zero.

Can anyone explain why I get these differences?

$\endgroup$

1 Answer 1

4
$\begingroup$

Shown is the actual output visible on the screen.

z = Series[-q (c[x1] - c[x2]), {x2, x1, 1}] 
(* q c'[x1] (x2 - x1) + O[x2 - x1]^2 *)

Exp[z] // Normal // Simplify 
(* 1 + q (-x1 + x2) c'[x1] *)

(Exp[z // Normal]) // Simplify
(* E^(q (-x1 + x2) c'[x1]) *)

The third expression Exp[z // Normal] converts the Series to normal linear expression and then exponentiates it, as expected.

In the second expression, the Series function is still active (because Normal has not yet been applied to it) and applies itself to all of Exp[...], as it is supposed to do, and only then does Normal convert it to a normal expression. In other words, it is performing

Series[Exp[-q (c[x1] - c[x2])], {x2, x1, 1}] 
(* 1 + q (-x1 + x2) c'[x1] *)

and only then applying Normal. See the documentation for O for a very relevant example.

Throughout, Simplify does not add much.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.