1
$\begingroup$

I am pretty new to Mathematica and these forums have helped me figure out almost everything except for how to simplify complex expressions. I have tried many combinations of complexsimplify and fullsimply and just simplify while also putting in bounds to make sure mathematica knows my variables are real, but I can't get it to spit out a the nicer analytical solution I'm sure exists. Everything is always kept in terms of abs[], rather than actually taking the modulus. It seems like these simplifications are very case dependent.

Anyway, here I am trying to simplify this expression, (sorry I don't know how to put it in traditional form here).

Abs[(Sqrt[-(Ay-kF2-q) (Ay+kF2-q)] Sqrt[(kF1-q) (kF1+q)])/(Sqrt[-(Ay-kF2-q) (Ay+kF2-q)] Sqrt[(kF1-q) (kF1+q)] Cos[L Sqrt[(Ay+kF2-q) (-Ay+kF2+q)]]-I (Sqrt[kF1^2] Sqrt[kF2^2]+(Ay-q) q) Sin[L Sqrt[-Ay^2+kF2^2+2 Ay q-q^2]])]^2
$\endgroup$
4
  • $\begingroup$ Are all the variables real? $\endgroup$ Jan 19, 2017 at 11:24
  • $\begingroup$ Are any of them strictly positive or negative? Can they be zero? $\endgroup$ Jan 19, 2017 at 11:30
  • $\begingroup$ Wow, thanks for getting back so quickly! Yes, all the variables are real, and they can be zero. The kF variables must be positive, but I think the others can be pos or neg $\endgroup$ Jan 19, 2017 at 11:40
  • $\begingroup$ It seems that with the information you give on the values of your parameters it is not too much that can be done. The problem is that we (as well as Mma) do not know, if the expressions under the radicals are positive. Otherwise one could advance several steps further. I propose that you separate out the conditions that, say, all expressions under the radicals are positive, then that one of them is negative, then two and so on, and use these conditions as the options to the Simplify and ComplexExpand statements. After you get some results, you can precise the question by re-editting. $\endgroup$ Jan 19, 2017 at 12:17

1 Answer 1

1
$\begingroup$

Let

expr = Abs[(Sqrt[-(Ay - kF2 - q) (Ay + kF2 - q)] Sqrt[(kF1 - q) (kF1 +
       q)])/(Sqrt[-(Ay - kF2 - q) (Ay + kF2 - q)] Sqrt[(kF1 - 
       q) (kF1 + q)] Cos[L Sqrt[(Ay + kF2 - q) (-Ay + kF2 + q)]] -
   I (Sqrt[kF1^2] Sqrt[kF2^2] + (Ay - q) q) Sin[
    L Sqrt[-Ay^2 + kF2^2 + 2 Ay q - q^2]])]^2;

If we try

ComplexExpand[expr]

then we see a lot of Arg functions in the output. But since none of them contain Sqrt or other things that could give us complex numbers (this can be inspected with Cases[ComplexExpand[expr], Arg[_], Infinity]), then all of them must be zero. Thus, doing

ComplexExpand[expr] /. Arg[_] -> 0

gives

(Sqrt[(kF1 - q)^2] Sqrt[(Ay + kF2 - q)^2] Sqrt[(kF1 + q)^2]
Sqrt[(-Ay + kF2 + q)^2])/(Sqrt[(kF1 - q)^2 (kF1 + q)^2]
 Sqrt[(Ay + kF2 - q)^2 (-Ay + kF2 + q)^2]
 Cos[L ((Ay + kF2 - q)^2 (-Ay + kF2 + q)^2)^(
  1/4)]^2 + (-Sqrt[kF1^2] Sqrt[kF2^2] - Ay q + q^2)^2 Sin[
 L ((-Ay^2 + kF2^2 + 2 Ay q - q^2)^2)^(1/4)]^2)

which I think is close to the most compact answer you can get. Doing

Simplify[%, Thread[{kF1, q, Ay, kF2, L} \[Element] Reals]]

does change the output, but to me it does not seem simpler.

OPINION: I agree that whether (Full)Simplify), (Complex)Expand or friends will give you what or not, is very case dependent. I also think that we cannot expect Mathematica to always do the correct/"best" simplification without double-checking the result, so the better approach is do try different things, study the output, and help Mathematica along the right path.

$\endgroup$
4
  • $\begingroup$ Thanks, I will try this in a little bit and let you know if it works for me. Cheers for helping me out! $\endgroup$ Jan 19, 2017 at 12:12
  • $\begingroup$ You don't need Thread. $\endgroup$
    – corey979
    Jan 19, 2017 at 12:15
  • 1
    $\begingroup$ Note that Arg[-1] is Pi, not 0 $\endgroup$
    – Carl Woll
    Jan 19, 2017 at 19:16
  • $\begingroup$ @CarlWoll, not only is your comment correct, but since Arg appears in Sin[1/2 Arg[x_]] and Cos[1/2 Arg[x_]], then these expressions will either be 0 or 1 (1 or 0) depending on Sign[x]. Unless I'm mistaken, this invalidates my whole answer! Note @AndrewMcRae, this is a good example of why one should wait a bit before accepting an answer :P $\endgroup$ Jan 19, 2017 at 20:10

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.