Question: function inside loop

phi:=array(1..3):

for q to 3 do

     phi[q] := x->p q x;

end do

Output

       phi[1]:= x -> p q x

          phi[2]:= x -> p q x

           phi[3]:= x -> p q x

>phi_1(2)

             6p

>phi_2(2)

          6P

----------------------------------

Above is my problem.

when I call function I only get last value of 'q'

and phi1, phi2, phi3 are same. Why so?

is there anyway that I can treat phi1(x), phi2, and phi3 as three different functions?

 

Thank YOu in Advance.

Please Wait...