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

Online Help

All Products    Maple    MapleSim


MmaTranslator[Mma]

  

Which

  

evaluate a specified test and return the value

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Which(arguments)

Parameters

arguments

-

Maple translation of the Mathematica command arguments

Description

• 

The Which command evaluates a specified test and returns its value corresponding to the first on the yields TRUE.

Examples

> 

with⁡MmaTranslatorMma:

> 

h:= proc (x) options operator, arrow; Which(x < -2, x/3, x > 3, x^2, true, 0) end proc;

h≔x↦MmaTranslator:−Mma:−Which⁡x<−2&comma;x3&comma;3<x&comma;x2&comma;true&comma;0

(1)
> 

h⁡6

36

(2)
> 

h⁡2

0

(3)

Alternatively, you can use the FromMma command with the evaluate option specified.

> 

with⁡MmaTranslator&colon;

> 

FromMma⁡`h[x_]:=Which[x < -2, x/3, x > 3, x^2, True, 0]`&comma;evaluate

x↦Which⁡x<−2&comma;x3&comma;3<x&comma;x2&comma;true&comma;0

(4)
> 

h⁡−5

−53

(5)

See Also

MmaTranslator

MmaTranslator[FromMma]

MmaTranslator[Mma]