The piecewise( Command

Command Summary

Graphs up to 5 piecewise expressions.

Command Syntax

(expression, condition [,expression, condition])

Up to 5 (expression,condition) pieces are allowed.

Menu Location

1: While editing a program, press [math]

2: Then press [alpha] [apps] (B) or scroll down.

Calculator Compatibility

TI-84+CE OS 5.3

Token Size

2 bytes

The piecewise( command is a new addition in the release of OS 5.3 for the TI-84 Plus CE. As implied, it allows for the graphing of piecewise functions in the Y= editor. The example code demonstrates how this works from within a program.

:Input "Y1=",Str1
:Input "Y2=",Str2

Advanced Uses

One use of the piecewise( function is to evaluate an expression for a given value of X. For example:


This code will return the value of the expression if X≥0. So if X=0, then the program will return a value of 2. If X=3, it will return a value of 11. If X=-5, it will return an error.


This command can simplify and compact the usage of piecewise expressions in programs. If you have less than 6 conditions that will never overlap, and they all affect a single variable, you can use the piecewise( command to make your code smaller, as shown below. Beware of comparability, though.

:If X<2
can be

Error Conditions

  • ERR:INVALID is thrown if expressions are not defined.
  • ERR:DATA TYPE is thrown if a quotation mark is not placed before a piecewise command that is to be stored to an equation variable.

See Also


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.