ifelse - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


convert/ifelse

convert to ifelse expression

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

convert(expr, ifelse)

convert(expr, ifelse, recurse)

Parameters

expr

-

expression to convert

Options

• 

recurse : true or false

  

This option specifies whether the transformation should be applied to subexpressions of the original expression expr. The default is false.

Description

• 

The convert(expr, ifelse) command accepts a Maple piecewise expression and return a result written in terms of nested calls to the ifelse function.

Examples

Convert a piecewise with three branches to nested ifelse calls.

> 

p≔piecewise⁡2<x&comma;1&comma;1<x&comma;2&comma;3

p≔12<x21<x3otherwise

(1)
> 

convert⁡p&comma;ifelse

ifelse⁡2<x&comma;1&comma;ifelse⁡1<x&comma;2&comma;3

(2)

Convert a nested piecewise to ifelse with and without the recurse option.

> 

p≔piecewise⁡2<x&comma;1&comma;piecewise⁡x2<y&comma;x2&comma;0<y&comma;x&comma;0

p≔12<xx2x2<yx0<y0otherwiseotherwise

(3)
> 

convert⁡p&comma;ifelse

ifelse⁡2<x&comma;1&comma;x2x2<yx0<y0otherwise

(4)
> 

convert⁡p&comma;ifelse&comma;recurse

ifelse⁡2<x&comma;1&comma;ifelse⁡x2<y&comma;x2&comma;ifelse⁡0<y&comma;x&comma;0

(5)

Compatibility

• 

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