# inequality with a piecewise function

Niek Sprakel shared this question 4 years ago

Hi.

When I use inequalities with piecewise functions, I get some unexpected results.

For instance here:

I have two piecewise-defined functions that are very similar (the only difference is that the two pieces are swapped).

But when I use an inequality statement, only one of the two piecewise-defined functions can be used to shade an area. Why doesn't that work with the other inequality?

Also, if a nested if statement for a piecewise-defined function can be used to shade an area with an inequality, it seems that an equivalent if statement that isn't nested can't be used in the same fashion to obtain a shaded area.

greetings and thanks in advance for any feedback on this issue, Niek You need to make sure both arguments of If() are functions, thus:

`h(x) = If(x < 1, cos(x), 2 + 0x)` 1

piecewise functions are not named in

I do not get any area with your not nested syntax

the no nested syntax is newest. I hope the issue is solved soon 1

You need to make sure both arguments of If() are functions, thus:

`h(x) = If(x < 1, cos(x), 2 + 0x)` 1

sorry, not enough

```f(x) = If(x < -1, x, -1 ≤ x, x²)
a: y < f(x)```
does not work

```g(x) = If(x < -1, x, -1 < x < 1, x², -x)
b: y < g(x)```
does not work

```g(x) = If(x < -1, x, If(-1 < x < 1, x², -x))
b: y < g(x)```
works