0
$\begingroup$

I have a complicated function that is returning a simple expression. The symbols a and b are unassigned. I have not been able to get Mathematica to simplify the expression. (This is only a simple example; I have the same problem with more complicated expressions). Here is what is returned by my function:

-Sqrt[(a^2/(a^2 + b^2)^2)] + a/(a^2 + b^2)

I try to simplify:

Simplify[%, Assumptions -> Element[a || b, Reals]]

but I get the same result. What am I doing wrong? Is this an issue with a and b being unassigned? (Does Simplify ignore unassigned symbols?)

I tried FullSimplify with the same result.

$\endgroup$

closed as off-topic by m_goldberg, Henrik Schumacher, Bob Hanlon, eyorble, LLlAMnYP Jul 31 '18 at 10:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Henrik Schumacher, Bob Hanlon, eyorble, LLlAMnYP
If this question can be reworded to fit the rules in the help center, please edit the question.

3
$\begingroup$

|| is the Or logic operator; you want the pattern operator Alternative. which is |.

Try

Simplify[expn, Element[a | b, Reals]]

or

Simplify[expn, Element[{a, b}, Reals]]

Both give

(a - Abs[a])/(a^2 + b^2)
$\endgroup$
  • $\begingroup$ Or (in v11.3) -Sqrt[(a^2/(a^2 + b^2)^2)] + a/(a^2 + b^2) // ComplexExpand // Simplify[#, Element[{a, b}, Reals]] & evaluates to Piecewise[{{(2*a)/(a^2 + b^2), a < 0}}, 0] $\endgroup$ – Bob Hanlon Jul 29 '18 at 14:51

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