4
$\begingroup$

I use the following code to find the expansion for small $x$:

Assuming[x \[Element] Reals, 
 FullSimplify@
  Series[-Sqrt[-x] I^(n + 1/2) HankelH1[n, -x], {x, 0, 1}]]

I find the solutions:

enter image description here

Analogously:

Assuming[x \[Element] Reals, 
 FullSimplify@
  Series[-Sqrt[-x] I^(n + 1/2) HankelH2[n, -x], {x, 0, 1}]]

enter image description here

What does True mean in the last lines?

$\endgroup$
0
10
$\begingroup$

From the documentation of Piecewise:

The $\text{cond}_i$ are evaluated in turn, until one of them is found to yield True.

The last condition is always True, so that Piecewise can return a value even when all the preceding conditions evaluated to False.

In a math textbook, this last case would be written as "otherwise".


When you write math notation for humans, you would make sure that the conditions are all disjoint, and there is an "otherwise" at the end. A CAS like Mathematica needs to handle junk input reasonable gracefully. What if some conditions overlap, or what if there's no "otherwise"? Symbolically verifying that the conditions are disjoint is not feasible (not only is it a hard problem that is not solvable in general, it would be very slow in many cases when it is solvable). This is why Mathematica resorts to evaluating conditions in turn, and taking the first one that is True. Additionally, it automatically adds a last True condition for "otherwise" if you haven't done so yourself.

$\endgroup$
2
  • $\begingroup$ I found this 109071 which is not about FullSimplify but close enough for a duplicate. Do you mind if I close? No point in moving your well written answer I guess so let's leave it as a road sign. $\endgroup$
    – Kuba
    Sep 4 '17 at 11:23
  • $\begingroup$ @Kuba Feel free to close. $\endgroup$
    – Szabolcs
    Sep 4 '17 at 11:24

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