assigning to a function a(1) (1.10.01)

Arieh Tal

The following behavior puzzles me: apparently Maple doesn’t consider a(1) as a different name than a but is also giving an error when I try to reassign a(1) and not when I reassign a?!


Adri van der Meer (2.10.01)


Here you make an undefined procedure a and place the value a(1) in its remember table:


Now you assign to a the value 12:


... which may act as the constant function x -> 12:


But, of course, a constant function doesn’t have a remember table, so you can not place a value in it.

Dr Francis J. Wright(2.10.01)

My best advice is not to use functional forms (i.e. anything of the general form y(x)) as variables. Maple allows this, but it causes considerable confusion. a(1) IS different from a. I will try to explain below what is happening in your example.


a is unbound and so a(1) is a valid functional form that can be used as a variable.


Now a has the value 12, and Maple accepts 12 as a constant function, so that 12 applied to any argument(s) returns the value 12.


But 12(1) is not a valid functional form for assignment. The above also explains the rest of your example.

If you want to define functions then use either the arrow syntax or the full procedure syntax.

[In fact, an assignment of the form y(x) := z implicitly assigns a procedure to y (if necessary) and then inserts an entry in its remember table, which can be very useful for defining ”point” mappings, base cases for recursion, etc. The error above arises because the integer 12 cannot be used as an identifier and so cannot be assigned a procedure.]

Preben Alsholm (3.10.01)

a(1) is not a valid name in Maple. But if a is unassigned or the name of a procedure, then a(1) means a applied to 1 and you can assign to that, like a(1):=37; which has the effect of putting that information in the remember table for a.

The command a:=12; makes a the integer 12. Even the command a:= x->12; is by Maple simplified to the integer 12, thus also in this case making it impossible to assign to a remember table. That in fact the command a(1); gives 12 is due to the fact that 12(1); by Maple is simplified to 12. You could do like this:


This way a is not simplified to the integer 12 and so we can assign to its remember table:


To see the remember table, do this:


Robert Israel (9.10.01)

a(1) isn’t a name, it’s the value of the function ”a” on the argument 1. At the start of your session, ”a” was unassigned. When you entered


Maple actually assigned a value to ”a”, namely a function that returns unevaluated, but has a remember table containing the value you assigned:


When you then said


you erased this definition, and gave ”a” the number 12 as a value. A number can be used as a function with a constant value:


But a number doesn’t have a remember table, so


is not allowed.