Mathematica 9 is now available

Piecewise

Usage

Piecewise[{{ ,  }, { ,  }, ... }] represents a piecewise function with values  in the regions defined by the conditions  .
Piecewise[{{ ,  }, ... }, val] uses default value val if none of the  apply. The default for val is 0.


Notes

• The  are typically inequalities such as a  x < b.
• The  are evaluated in turn, until one of them is found to yield True.
• If all preceding  yield False, then the  corresponding to the first  that yields True is returned as the value of the piecewise function.
• If any of the preceding  do not literally yield False, the Piecewise function is returned in symbolic form.
• Only those  explicitly included in the returned form are evaluated.
• Elements of the form { , False} are dropped, as are all elements after the first { , True}.
Piecewise can be used in such functions as Integrate, Minimize, Reduce, DSolve and Simplify, as well as their numeric analogs.
Piecewise[{{ ,  }, { ,  }, ... }] can be input in the form  .  can be entered as AliasIndicatorpwAliasIndicator or \[Piecewise]. The grid of values and conditions can be constructed by first entering ControlKeyLeftModified,RightModified, then using ControlKeyLeftModified RightModified (Control-Return) and ControlKeyLeftModified,RightModified.
• In StandardForm and TraditionalForm, Piecewise[{{ ,  }, { ,  }, ... }] is normally output as  .
• See Section 3.2.3.
• New in Version 5.1.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.