5
$\begingroup$

I am doing some complicated series expansions involving integrals and whatnot, but everything is real the whole time (and I specify that using Assumptions at every step). Variants of the expression $$(1-e^2)^{3/2}$$ pop up frequently (0 < e < 1); however, Mathematica keeps representing it as $$I*(-1+e^2)^{3/2}$$ instead, which is messing up some steps further down the line.

Is there a simple reason for this behavior or a way to stop/reverse it?

Edit: Here is the specific example, if it helps:

func1[p_, e_, chi2_] := (p^2 [(-4 e^2 + (-2 + p)^2)/(-6 + p - 
2 e Cos[chi2])]^(1/2))/((-2 + p - 2 e Cos[chi2]) (1 + e Cos[chi2])^2);

func2[p_, e_, chi2_] := Normal[Series[func1[p, e, chi2], {p, Infinity, 3}]];

result= Series[(p)^(3/2)*2*Pi/Integrate[func2[p, e, chi2], {chi2, 0, 2*Pi}, 
 Assumptions -> Element[e | p, Reals] && e > 0 && p > 0 && e < 1], {p, Infinity, 2}]

This gives

I (-1 + e^2)^(3/2) + (3 I (-1 + e^2)^(5/2))/p + (3 I (-1 + e^2)^(3/2) (2 - 8 
e^2 + 6 e^4 - 5 Sqrt[1 - e^2] + 5 e^2 Sqrt[1 - e^2]))/(2 p^2)

$$I (-1 + e^2)^{3/2} + (3 I (-1 + e^2)^{5/2})/p + (3 I (-1 + e^2)^{3/2} (2 - 8 e^2 + 6 e^4 - 5 (1 - e^2)^{1/2} + 5 e^2 (1 - e^2)^{1/2}))/(2 p^2)$$

$\endgroup$

2 Answers 2

2
$\begingroup$

You don't say explicitly or give an example of how the form arises. It does not happen automatically for me when I enter (1 - e^2)^(3/2). So it's hard to guess what might prevent it. But here is a way to reverse the factoring out of I:

expr = I*(-1 + e^2)^(3/2);
Simplify[expr,
 Assumptions -> 0 < e < 1,
 ComplexityFunction -> (LeafCount[#] + 100 Count[#, Complex[0, _], Infinity] &)]

(*  (1 - e^2)^(3/2)  *)

On OP's updated example:

Simplify[result, Assumptions -> 0 < e < 1,
 ComplexityFunction -> (LeafCount[#] + 100 Count[#, Complex[0, _], Infinity] &)]

Mathematica graphics

$\endgroup$
5
  • $\begingroup$ It happens if you use E rather than e. @cmm0052, that's one of the pitfalls of rendering things in LaTeX rather than Mma code (as is the preferred convention here). $\endgroup$
    – evanb
    Apr 9, 2017 at 16:14
  • $\begingroup$ @evanb Thanks. I considered whether E was meant, but I assumed the OP meant e since the OP explicitly writes "(0 < e < 1)". $\endgroup$
    – Michael E2
    Apr 9, 2017 at 16:21
  • $\begingroup$ @ebanb -- this doesn't make sense. If the OP meant E, then 0<E<1 is impossible (since E $\approx$ 2.73) $\endgroup$
    – bill s
    Apr 9, 2017 at 17:46
  • $\begingroup$ I have added the specific example. "e" is a variable, but not the one being expanded over. Sorry for the confusion! $\endgroup$
    – cmm0052
    Apr 9, 2017 at 17:53
  • $\begingroup$ @cmm0052 Thanks. I think you changed a Sqrt to a 1/2 power, but forgot to remove the square brackets (typo in your edit). $\endgroup$
    – Michael E2
    Apr 9, 2017 at 17:57
1
$\begingroup$

I often use something like the following to protect subexpressions that I don't want to be changed by simplification:

(1 - e^2)^(3/2) /. e^2 -> 1 - HoldForm[1 - e^2];

This protection can be removed, if necessary using ReleaseHold

$\endgroup$

Your Answer

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

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