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

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

withMmaTranslatorMma:

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

hxMmaTranslator:−Mma:−Whichx<−2&comma;x3&comma;3<x&comma;x2&comma;true&comma;0

(1)

h6

36

(2)

h2

0

(3)

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

withMmaTranslator&colon;

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

xWhichx<−2&comma;x3&comma;3<x&comma;x2&comma;true&comma;0

(4)

h5

53

(5)

See Also

MmaTranslator

MmaTranslator[FromMma]

MmaTranslator[Mma]