Piecewise Function Calculator

This evaluates a piecewise function that you enter as up to four numbered pieces, each with an expression in x and a lower and upper bound. One mode returns the value at a single x and names the piece that covered it; the other steps across a range and prints a table of values. An expression may use numbers, x, the operators plus, minus, times, divide and power, brackets, and abs() and sqrt(), and nothing else, so this is not a parser for arbitrary functions. It draws no graph either, and the table of values is what it offers instead.

Calculator Type

Enter the pieces once, then the x you want. The piece that was used and the condition it matched are printed with the answer.

Numbers, x, + - * / ^, brackets, abs() and sqrt(). Nothing else.
Widget

Steps x across a range and prints the value at each point. It is a table rather than a graph, which is what you would plot by hand or paste into a spreadsheet.

At most 41 points are printed.
Numbers, x, + - * / ^, brackets, abs() and sqrt(). Nothing else.
Widget