# Edit piecewise function

Downstream of a long process I got the following function:

$\begin{cases} 0 & x < 0 \, \vee \, x > \frac{307}{400} \\ 14.27-7.44\,x & 0 < x < \frac{307}{400} \\ \text{Indeterminate} & \text{True} \end{cases}$

I would like to know if you can delete the last case, without manual intervention, but with a code. I searched far and wide but could not find anything effective.

Thank you!

• Maybe just do expr /. Intermediate -> 0? (Where expr is your function.) Jul 27, 2016 at 16:53
• @march /. Indeterminate -> 0 But yes, this works. Jul 27, 2016 at 17:02
• @Feyre. I can't even blame autocorrect because I typed that on my computer. :) Jul 27, 2016 at 17:04

This seems to be a good application for PiecewiseExpand:

f[x_] := Piecewise[{{1, x > 0}, {0, x < 0}, {Indeterminate, True}}]
f[x]

$$\begin{cases} 1 & x>0 \\ 0 & x<0 \\ \text{Indeterminate} & \text{True} \end{cases}$$

g[x_] := Piecewise[{{f[x], x != 0}, {0, True}}]
h[x_] = PiecewiseExpand[g[x]]

$$\begin{cases} 1 & x>0 \\ 0 & \text{True} \end{cases}$$

I split this up into steps just for illustration. The end result is the function h which has only the two relevant cases.