Question: How to solve illegal use of a formal parameter

where is wrong?

illegal use of a formal parameter

 

evolf := proc(z, f, terminal_counter)
h1 := z + f;
h2 := z - f;
h3 := z*f;
h4 := z+diff(f,x);
h5 := z-diff(f,x);
h6 := z*diff(f,x);
h7 := subs(x=z, f);
N := 7;
test := [h1, h2, h3, h4, h5, h6, h7];
print(test);
fitness := [0, 0, 0, 0, 0, 0, 0];

if terminal_counter > 5 then
    return fitness;
end if;

total_fitness := 0;
for i from 1 to N do
    temp1 := 0;
    temp2 := 0;
    for j from 0 by 0.1 to 1 do
        temp1 := eval(subs(x=j,test[i])^2);
        temp2 := eval(subs(x=j,f)^2);
    od;
    fitness[i] := 1/(1+temp1+temp2);
    total_fitness := total_fitness + 1/(1+temp1+temp2);
od;
for i from 1 to N do
    fitness[i] := fitness[i]/evalf(total_fitness);
od;
print(select(t->type(fitness[op(t)], max(fitness)), [$1..nops(fitness)])[1]);
print(test[select(t->type(fitness[op(t)], max(fitness)), [$1..nops(fitness)])[1]]);

terminal_counter := terminal_counter + 1;
if max(fitness) = min(fitness) then
    return fitness;
end if;
fitness := evolf(test[select(t->type(fitness[op(t)], max(fitness)), [$1..nops(fitness)])[1]], f, terminal_counter);
return fitness;
end proc;
fitness := evolf(x^2, x+1, 1);

Please Wait...