0

I'd like to define a table of functions like so

Table[Function[{x,y},{x + k y,x - k y}] , {k,1,10}]

My intention is to have the first function defined with k=1, the second with k=2, etc. This is not what happens; they are all defined with the variable k.

I think it has to do with evaluation time. When applying these functions, they will use k, however k is defined in application time.

How can I correct this behavior ?

Teddy
  • 153
  • 4

1 Answers1

1

You need a function that creates a function of k.

Table[Function[{x, y}, {x + # y, x - # y}] &[k], {k, 1, 10}]
Edmund
  • 42,267
  • 3
  • 51
  • 143