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 Euc
and pass in 12 for parameter a
and 8 for parameter b
. Inside the body of Euc
, as it runs in this instance, a
evaluates to 12 and a
does not evaluate to a name to which you can make an assignment. When you try and make an assignment to a
or b
inside Euc
then you see that error.