# Usage of simplify with If and Sum [duplicate]

I have a question related to this post I made : Why is the function assuming not taken in consideration?

Consider the following code :

f[x_] := Sum[x^i, {i, 1, 10}]

Assuming[a > 0 && b > 0, Simplify[If[a + b != 0, f[x], 0]]]

If[a + b != 0, f[x], 0]

f[x_] := x^2

Assuming[a > 0 && b > 0, Simplify[If[a + b != 0, f[x], 0]]]

x^2


When the function f is a sum, we don't have the simplification of the If, even if the function is not the condition of the If (but the output value if the condition is true).

However, when the function is $$x^2$$, the simplify works fine.

I don't understand the behavior in the first case, why isn't the simplification done ?

MichaelE2 explained me in the other question I asked that I have to put the simplify inside the sum and not outside to use the assumptions, else it doesn't work. But this is to simplify a Sum function. Here my simplification actually occurs to the condition of the If (so it is a different problem).

Could you explain me why my simplification doesn't occur ? I know I could do the simplification directly on the condition in the If but I want to understand what is the problem here.

And other question : when I apply simplify on a big expression, is the simplification done at all level of the expression ? It is not explained in the documentation of simplify.

f[x_] := Sum[x^i, {i, 1, 10}]

Piecewise[{{a + b != 0, f[x]}}, 0]