I try to write functions in mupad but it seems I haven't understood how procedures and identifiers work. I get every time the message "Error: Unexpected 'identifier'". First example: I tried changing the first row of a given matrix to [1 1 ... 1]. I wrote the following code:
shibutz:=proc(B)
begin
cons:=Dom::Matrix():
l:=max(cons::matdim(B));
for k from 1 to l do
B[1,k]:=1;
end_for
print(B);
end_proc
Second example: Another code which gets the same error is a procedure I wrote verifying goldbach theorm that every even number is sum of two prime numbers:
golbach:=proc(n)
begin
flag=bool(9<8);
theprimes:=select([$2..n-1],isprime);
for k from 1 to nops(theprimes) do
if(isprime(n-k)=TRUE) then
flag=bool(1>0);
end_if
end_for
return (flag);
end_proc
What am I doing wrong? which identifiers mupad didn't expect?