1
$\begingroup$

I am trying to replace $\text{xn}$ in

$\qquad O(\epsilon )^3+\left(\text{xn}^2+2 \text{xn}\right) \epsilon +\left(-2 \text{xn}^3-4 \text{xn}^2\right) \epsilon ^2-1$

with $O(\epsilon )^2+\epsilon +1$.

I want an output like a simplified series of $\epsilon$: $-1+3 \epsilon -2 \epsilon ^2+O\left(\epsilon ^3\right)$.

When I evaluate

-1+(2 xn + xn^2) ϵ + (-4 xn^2 - 2 xn^3) ϵ^2 + O[ϵ]^3 /. xn -> 1 + ϵ + O[ϵ]^2

I get

output

and Simplify doesn't work on this output.

The solution I am using now applies Normal then adds the O[ϵ]^3.

temp = -1 + (2 xn + xn^2) ϵ + (-4 xn^2 - 2 xn^3) ϵ^2 + O[ϵ]^3
Normal[temp /. xn -> 1 + ϵ + O[ϵ]^2] + O[ϵ]^temp[[5]]

output

I'd to know is there a more efficient way to solve this problem.

$\endgroup$
  • $\begingroup$ temp /. xn -> 1 + \[Epsilon] seems to give what you seek. Is that correct? $\endgroup$ – Michael E2 Jul 29 '19 at 18:37
  • $\begingroup$ In MMA v11.0.1 temp /. xn -> 1 + \[Epsilon] + O[\[Epsilon]]^2 does the job as expected! $\endgroup$ – Ulrich Neumann Jul 30 '19 at 6:44
  • $\begingroup$ my version is MMA v11.1, and temp /. xn -> 1 + [Epsilon] + O[[Epsilon]]^2, temp /. xn -> 1 + [Epsilon] give the output $-1+\epsilon \left(3+4 \epsilon +O\left(\epsilon ^2\right)\right)+\epsilon ^2 \left(-6-14 \epsilon +O\left(\epsilon ^2\right)\right)+O\left(\epsilon ^3\right)$ which is not i expected. $\endgroup$ – Leon.D Jul 30 '19 at 22:57
  • $\begingroup$ I get what you expected: see i.stack.imgur.com/iWoMn.png (I'm using V12.0, but the behavior of SeriesData has been stable through several version, I think. Perhaps try restarting your kernel) -- Site tip: Use @user to be sure a user is notified of your reply (e.g. @MichaelE2 or @UlrichNeuman); the author of a post (you in this case) is always notified of comments on the post. Also if you put code between backticks in a comment, it will be formatted properly. $\endgroup$ – Michael E2 Jul 31 '19 at 15:05
  • 1
    $\begingroup$ This might be from a buglet that will be addressed in the next release. I believe it was reported a few months ago in this forum but I cannot seem to find the right thread. $\endgroup$ – Daniel Lichtblau Aug 3 '19 at 19:20

Browse other questions tagged or ask your own question.