2
$\begingroup$

I want to series expansion the expression $\frac{1}{2} \left(e_1+e_2-\sqrt{e_1^2-2e_1e_2+e_2^2+4V_{12}^2} \right)$ up to second order in $V_{12}$ using the assumption $e_1>e_2$. So I tried

Series[1/2 (e1 + e2 - Sqrt[e1^2 - 2 e1 e2 + e2^2 + 4 V12^2]), {V12, 0, 2}, 
Assumptions -> e1 > e2] // FullSimplify

But there is still $\sqrt{(e_1-e_2)^2} $ terms in the results. What should I do to make the assumption $e_1>e_2$ work?

$\endgroup$
6
  • 2
    $\begingroup$ You have to enter the expression in Mathematica code, not TeX code. $\endgroup$
    – Michael E2
    Jun 30, 2014 at 14:37
  • $\begingroup$ @MichaelE2 fyi, Wolfram alpha was smart enough to parse part of this command even in Latex! It gave back Series Sqrt, ok not exactly the full command, but very impressive none-the-less !Mathematica graphics may be in the future with more AI it will be able to process full latex input as well. $\endgroup$
    – Nasser
    Jun 30, 2014 at 14:54
  • 1
    $\begingroup$ @Nasser ToExpression["\\frac {1} {2}\\left (e_ 1+e_ 2- \\sqrt {e_ 1^2-2 e_ 1 e_ 2+e_ 2^2+4 V_ {12}^2} \\right)", TeXForm] -- have to add the extra backslashes by hand, I guess. :( $\endgroup$
    – Michael E2
    Jun 30, 2014 at 15:23
  • $\begingroup$ I only enter the tex code for display purpose. Thank you anyway! $\endgroup$ Jun 30, 2014 at 15:23
  • 3
    $\begingroup$ But "display purpose" is not nearly as useful as cut-and-pasteable, if people are to attempt any diagnosis. $\endgroup$ Jun 30, 2014 at 15:37

2 Answers 2

3
$\begingroup$

Assumptions given to Series are not used by FullSimplify that you have in your code.

To pass Asumptions to all functions in given expression, wrap said expression with Assuming:

Assuming[e1 > e2,
    Series[1/2 (e1 + e2 - Sqrt[e1^2 - 2 e1 e2 + e2^2 + 4 V12^2] ), {V12, 0, 2}] // Simplify
]
(* e2 + V12^2/(-e1+e2) + O[V12]^3*)

Or, if you want to always use those assumptions in given session, assign them to $Assumptions:

$Assumptions = e1 > e2;
Series[1/2 (e1 + e2 - Sqrt[e1^2 - 2 e1 e2 + e2^2 + 4 V12^2] ), {V12, 0, 2}] // Simplify
(* e2 + V12^2/(-e1+e2) + O[V12]^3*)
$\endgroup$
1
  • $\begingroup$ Yeah, that make sense! awesome reply! $\endgroup$ Jun 30, 2014 at 15:29
1
$\begingroup$

If we remove the subscripts from the converted TeX,

ToExpression[
 "\\frac{1}{2} \\left(e_1+e_2-\\sqrt{e_1^2-2e_1e_2+e_2^2+4V_{12}^2} \\right)",
 TeXForm] /. Subscript[b_, e_] :> b[e]
(*
  1/2 (e[1] + e[2] - Sqrt[e[1]^2 - 2 e[1] e[2] + e[2]^2 + 4 V[12]^2])
*)

we can simply use PowerExpand:

Series[
 1/2 (e[1] + e[2] - Sqrt[e[1]^2 - 2 e[1] e[2] + e[2]^2 + 4 V[12]^2]),
 {V[12], 0, 2}] // PowerExpand
(*
  e[2] - V[12]^2 / (e[1] - e[2]) + O[V[12]]^3
*)

Edit: I should have been more careful:

PowerExpand[
 Series[1/2 (e[1] + e[2] - Sqrt[e[1]^2 - 2 e[1] e[2] + e[2]^2 + 4 V[12]^2]), {V[12], 0, 2}],
 Assumptions -> e[1] > e[2]
 ]
(* same as above *)

See the link for the explanation in the PowerExpand documentation.

$\endgroup$
2
  • $\begingroup$ I can convert my code between mathematica and Tex! That's really cool! Thanks! However, how comes it got the correct answer without the assumption e[1]>e[2], is this implicit in using the functions? $\endgroup$ Jun 30, 2014 at 18:06
  • $\begingroup$ @KevinPowell That was my sloppiness and my luck. The link explains it. PowerExpand just picks one way if the assumptions are not specified. I should have specified the assumptions. $\endgroup$
    – Michael E2
    Jun 30, 2014 at 18:21

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.