Problem with simplification in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter physics_nil
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around the behavior of Mathematica's FullSimplify function when applied to an expression involving square roots and assumptions about the positivity of variables. Participants explore why the function does not simplify a specific expression to zero, despite it being true under certain conditions.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes that FullSimplify does not simplify the expression to zero because doing so would discard one possibility, as the square root can represent both positive and negative values.
  • Another participant argues that the assumptions of positivity for a, b, and c should lead to a simplification to zero, citing that Mathematica simplifies similar expressions correctly under positive assumptions.
  • A different viewpoint suggests that even with positive assumptions, the square root expressions involved may not be guaranteed to be positive, indicating a need for explicit handling of the square roots in the simplification process.
  • One participant proposes using the Reduce function to analyze the conditions under which the expression equals zero, providing a more comprehensive view of the relationships between the variables.
  • Another participant questions the consistency of Mathematica's behavior regarding square roots, suggesting that it may only consider the positive square root in certain contexts.
  • A participant expresses a concern about the complexity of the final output if the simplification does not yield zero, seeking suggestions for improving readability in a longer program.

Areas of Agreement / Disagreement

Participants express differing views on the behavior of Mathematica's simplification process, with no consensus reached on the reasons behind the observed outcomes. The discussion remains unresolved regarding the best approach to achieve the desired simplification.

Contextual Notes

Participants highlight limitations related to assumptions about the positivity of square roots and the implications of those assumptions on the simplification process. There is also mention of the need for explicit instructions to handle square roots correctly.

physics_nil
Messages
4
Reaction score
0
Assuming[a>0 && b>0 && c>0, FullSimplify[a+Sqrt[b+c]-Sqrt[a^2+b+c+2 a Sqrt[b+c]]]] does not simplify it to zero. Although output of FullSimplify[a+Sqrt[b+c]-Sqrt[a^2+b+c+2 a Sqrt[b+c]]==0] is true, even without any assumptions. Can anyone please resolve this puzzle...Thanks
 
Physics news on Phys.org
The reason it doesn't simplify to zero is that this would throw away one possibility. Basically you are asking it to simplify (x-Sqrt(x^2)). Since Sqrt(x^2) can be either x or -x, (x-Sqrt(x^2)) can be either 0 or 2x. By simplifying this to zero, you are throwing away the second possibility. Mathematica will keep all possibilities unless you explicitly tell it otherwise.
 
Your statement is not true as i have specified a>0,b>0,c>0
If you ask mathematica to simplify x-Sqrt[x^2] with assumption x>0, it indeed gives zero!
 
I used the simplified example with x to illustrate the problem. In your problem, just because a,b,c>0 doesn't mean that Sqrt[b+c]>0, or that Sqrt[a^2+b+c+2 a Sqrt[b+c]]>0. Even if you tell it that both of these are >0, that still isn't enough. You have to either explicitly tell it to use the positive square root, like this:

FullSimplify[ a + Sqrt[b + c] - Sqrt[a^2 + b + c + 2 a Sqrt[b + c]] /.
Sqrt[a^2 + b + c + 2 a Sqrt[b + c]] -> a + Sqrt[b + c]]

or else square both terms to eliminate the sign ambiguity, like this:

FullSimplify[(a + Sqrt[b + c])^2 - (Sqrt[
a^2 + b + c + 2 a Sqrt[b + c]])^2, {a > 0, b > 0, c > 0}]

It's only a computer program, after all, so it does have its limitations.
 
If you're only interested a, b and c being real, then you could use something like:

In[1]:= Reduce[a+Sqrt[b+c]-Sqrt[a^2+b+c+2 a Sqrt[b+c]]==0,{a,b,c},Reals]
Out[1]= (a<=0&&c>=a^2-b)||(a>0&&c>=-b)

In[2]:= Simplify[%,a>0&&b>0&&c>0]
Out[2]= True
 
@phyzguy
Then why Assuming[x>0,Sqrt[x^2] //Simplify] is x? I think mathematica only considers positive sqrt.
 
@Simon_Tyler
The step comes in a intermediate step of a long program. Unless the answer in simplification is zero, the final answer is too complicated to read. Any suggestion?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K