Error, illegal use of an object as a name - Maple Programming Help

Home : Support : Online Help : System : Error Message Guide : illegaluseofanobjectasaname

Error, illegal use of an object as a name

 Description This error occurs when an object that is not a name is used where Maple expects a name.  This will occur when you make an assignment (using :=) and the left-hand side is not an assignable object or a sequence of assignable objects.  The same issue occurs when you use a nonassignable object as an index variable or in another place where a name is expected.

Examples

Example 1

 > $\left[a,b\right]≔\left[5,6\right]$

The problem is that the left-hand side is a list.  It must be a name or a sequence of names.

Solution:  To make multiple assignments, use two assignment statements or put a sequence of names on the left-hand side.

 > $a,b≔5,6$
 ${a}{,}{b}{≔}{5}{,}{6}$ (2.1)

Example 2

 > $\mathrm{seq}\left({I}^{2},I=1..5\right)$
 > $I≔2$
 

$I$ is used to denote the imaginary unit ($\sqrt{-1}$) in Maple.  You cannot assign to this name or use it for an index variable.

Solution:  Use a different name.

 > $\mathrm{seq}\left({i}^{2},i=1..5\right)$
 ${1}{,}{4}{,}{9}{,}{16}{,}{25}$ (2.2)
 > $J≔2$
 ${J}{≔}{2}$ (2.3)

Example 3

 >
 ${\mathrm{myProcedure}}{≔}{\mathbf{proc}}\left({n}{::}{\mathrm{evaln}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{n}{^}{2}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (2.4)
 > $\mathrm{myProcedure}\left(3\right)$

In this procedure, the evaln modifier expects a parameter that evaluates to a name.

Solution: Call the myProcedure with a parameter that is assignable.

 > $N≔3$
 ${N}{≔}{3}$ (2.5)
 > $\mathrm{myProcedure}\left(N\right)$
 ${{N}}^{{2}}$ (2.6)