Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
2  
You have to enter the expression in Mathematica code, not TeX code. –  Michael E2 Jun 30 at 14:37
    
@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. –  Nasser Jun 30 at 14:54
1  
@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. :( –  Michael E2 Jun 30 at 15:23
    
I only enter the tex code for display purpose. Thank you anyway! –  Kevin Powell Jun 30 at 15:23
2  
But "display purpose" is not nearly as useful as cut-and-pasteable, if people are to attempt any diagnosis. –  Daniel Lichtblau Jun 30 at 15:37

3 Answers 3

up vote 1 down vote accepted

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*)
share|improve this answer
    
Yeah, that make sense! awesome reply! –  Kevin Powell Jun 30 at 15:29

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.

share|improve this answer
    
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? –  Kevin Powell Jun 30 at 18:06
    
@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. –  Michael E2 Jun 30 at 18:21
Series[1/2 (e1 + e2 - Sqrt[e1^2 - 2 e1 e2 + e2^2 + 4 V12^2]), {V12, 0,
2}] // Simplify[#, e1 > e2] &

enter image description here

share|improve this answer
    
fyi, this is pretty much the same answer given by jkuczm above. –  Nasser Jun 30 at 22:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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