I keep getting that error. Here’s the code (it’s for GCD):
Euc := proc (a, b)
if b = 0 then a;
else c := b;
d := a mod b;
b := d; a := c;
end if;
end proc;
I never use Maple because it gives me a headache and the documentation is a nightmare, but this assignment has to be done all in Maple… if I’m having trouble with simple GCD, I don’t see me writing RSA and El Gamal by Wednesday :s
edit: Fixed it with
Euc := proc (a, b)
if b = 0 then a;
else c := b;
d := a mod b;
Euc(c,d);
end if;
end proc;
But any I’d still like to know what the problem was, in case I have to do something similar again.
Your first version attempted to assign to the formal parameters of the procedure. That was the problem.
Suppose you call your original
Eucand pass in 12 for parameteraand 8 for parameterb. Inside the body ofEuc, as it runs in this instance,aevaluates to 12 andadoes not evaluate to a name to which you can make an assignment. When you try and make an assignment toaorbinsideEucthen you see that error.