assigned - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Operations : Assignment : assigned

assigned

check if a name is assigned

 Calling Sequence assigned(n)

Parameters

 n - name, subscripted name, or function call

Description

 • The assigned function returns true if n has a value other than its own name, and returns false otherwise.
 Note: The assigned function returns true if you have placed assumptions on n using the assume command.
 • This function is one of the exceptions to the normal evaluation rule for arguments of a function. The argument to assigned will only be evaluated as a name (see the evaln function) rather than fully evaluated.
 • The definition of assigned for array/table subscripts is

$\mathrm{assigned}\left({A}_{i}\right)=\mathrm{evalb}\left({A}_{i}\ne \mathrm{evaln}\left({A}_{i}\right)\right)$

 • The definition of assigned for function calls is

$\mathrm{assigned}\left(f\left(x\right)\right)=\mathrm{evalb}\left(f\left(x\right)\ne \mathrm{evaln}\left(f\left(x\right)\right)\right)$

Thread Safety

 • The assigned command is thread-safe as of Maple 15.
 • For more information on thread safety, see index/threadsafe.

Examples

 > $a≔\mathrm{table}\left(\mathrm{symmetric}\right)$
 ${a}{≔}{\mathrm{table}}\left({\mathrm{symmetric}}{,}\left[{}\right]\right)$ (1)
 > ${a}_{1,2}≔x$
 ${{a}}_{{1}{,}{2}}{≔}{x}$ (2)
 > $\mathrm{assigned}\left({a}_{1,2}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{assigned}\left({a}_{2,1}\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{assigned}\left({a}_{1,1}\right)$
 ${\mathrm{false}}$ (5)
 > $\mathrm{assigned}\left(\left|x\right|\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{assigned}\left(\left|2\right|\right)$
 ${\mathrm{true}}$ (7)
 > $f≔x→{x}^{2}$
 ${f}{≔}{x}{→}{{x}}^{{2}}$ (8)
 > $\mathrm{assigned}\left(f\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{assigned}\left(f\left(x\right)\right)$
 ${\mathrm{true}}$ (10)
 > $\mathrm{assigned}\left(f\left(2\right)\right)$
 ${\mathrm{true}}$ (11)

If you place an assumption on a name using the assume command, the assigned command returns true for that name.

 > $\mathrm{assigned}\left(b\right)$
 ${\mathrm{false}}$ (12)
 > $\mathrm{assume}\left(b,\mathrm{positive}\right)$
 > $\mathrm{assigned}\left(b\right)$
 ${\mathrm{true}}$ (13)

Note: Evaluating an assigned call under an assumption (using the assuming command), returns true for a name only if it has a value different from its name.

 > $\mathrm{assigned}\left(c\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}assuming\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}c::\mathrm{integer}$
 ${\mathrm{false}}$ (14)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam