convert/ifelse
convert to ifelse expression
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
convert(expr, ifelse)
convert(expr, ifelse, recurse)
expr
-
expression to convert
recurse : true or false
This option specifies whether the transformation should be applied to subexpressions of the original expression expr. The default is false.
The convert(expr, ifelse) command accepts a Maple piecewise expression and return a result written in terms of nested calls to the ifelse function.
Convert a piecewise with three branches to nested ifelse calls.
p≔piecewise⁡2<x,1,1<x,2,3
p≔12<x21<x3otherwise
convert⁡p,ifelse
ifelse⁡2<x,1,ifelse⁡1<x,2,3
Convert a nested piecewise to ifelse with and without the recurse option.
p≔piecewise⁡2<x,1,piecewise⁡x2<y,x2,0<y,x,0
p≔12<xx2x2<yx0<y0otherwiseotherwise
ifelse⁡2<x,1,x2x2<yx0<y0otherwise
convert⁡p,ifelse,recurse
ifelse⁡2<x,1,ifelse⁡x2<y,x2,ifelse⁡0<y,x,0
The convert/ifelse command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
convert
ifelse
Download Help Document
What kind of issue would you like to report? (Optional)