attributes - Maple Help

attributes

return the attributes

setattribute

assign attributes

 Calling Sequence attributes(e) setattribute(e, a)

Parameters

 e - expression a - (optional) attribute

Description

 • The setattribute(e, a) calling sequence returns a copy of the expression e with attribute a assigned. If the expression, e, is a symbol or string, it is also modified in-place. For other data types, the original expression is unchanged.
 Calling setattribute without parameter a removes all attributes from expression e.
 • Attributes of an expression can be queried by using attributes(e).
 • All Maple expressions are valid attributes. In particular, expression sequences can be used to assign multiple attributes to an object.
 • An expression with attributes (other than the NULL expression sequence) is said to be attributed. (See type/attributed.)
 • Attributes can be assigned to only a name, string, list, set, Array, Matrix, Vector, equation, procedure, unevaluated function call, or a float.
 • Attributes on rtables can also be set and queried by using the appropriate ArrayOptions, MatrixOptions, or VectorOptions (or generically, rtable_options) command.

 • The attributes and setattributes commands are thread safe as of Maple 15, provided that the expression e is not shared between threads.

Examples

Set attributes and query the attributes of an expression.

 > $\mathrm{attributes}\left(a\right)$
 > $\mathrm{setattribute}\left(a,\mathrm{blue}\right)$
 ${a}$ (1)
 > $\mathrm{attributes}\left(a\right)$
 ${\mathrm{blue}}$ (2)
 > $\mathrm{setattribute}\left(a,\mathrm{yellow},\mathrm{green}\right)$
 ${a}$ (3)
 > $\mathrm{attributes}\left(a\right)$
 ${\mathrm{yellow}}{,}{\mathrm{green}}$ (4)

Remove all attributes from the expression a.

 > $\mathrm{setattribute}\left(a\right)$
 ${a}$ (5)
 > $\mathrm{attributes}\left(a\right)$
 > $\mathrm{setattribute}\left(s,\mathrm{sin}\left(\frac{\mathrm{\pi }}{4}\right)\right)$
 ${s}$ (6)
 > $\mathrm{attributes}\left(s\right)$
 $\frac{\sqrt{{2}}}{{2}}$ (7)
 > $F≔\mathrm{setattribute}\left(g\left(2\right),"a banana"\right)$
 ${F}{≔}{g}{}\left({2}\right)$ (8)
 > $A≔\mathrm{attributes}\left(g\left(2\right)\right)$
 > $B≔\mathrm{attributes}\left(F\right)$
 ${B}{≔}{"a banana"}$ (9)
 > $H≔\mathrm{setattribute}\left(t,\left[2,3,4\right]\right)$
 ${H}{≔}{t}$ (10)
 > $\mathrm{attributes}\left(H\right)$
 $\left[{2}{,}{3}{,}{4}\right]$ (11)
 > $\mathrm{setattribute}\left(\mathrm{x1},y=5x+3\right)$
 ${\mathrm{x1}}$ (12)
 > $\mathrm{attributes}\left(\mathrm{x1}\right)$
 ${y}{=}{5}{}{x}{+}{3}$ (13)