This is too long to be left as a comment. Essentially, I am elaborating a bit more on what @Nasser pointed out.
With the definitions in the OP
P = Table[{i^2, j}, {i, 10}, {j, -1.2, 1.2, .2}];
f = Interpolation[Table[{ky, Cos[ky]}, {ky, 0, 1.2, 0.003}],
InterpolationOrder -> 0];
when we do
P // Dimensions
we get
{10, 13, 2}
What does this mean?
Well, if you do
P[[1]]
you get
{{1, -1.2}, {1, -1.}, {1, -0.8}, {1, -0.6}, {1, -0.4}, {1, -0.2}, {1, 2.22045*10^-16}, {1, 0.2}, {1, 0.4}, {1, 0.6}, {1, 0.8}, {1, 1.}, {1, 1.2}}
and you have 10 of those things.
If you do
P[[1]] // Dimensions
you get
{13,2}
which tells you that in the list P[[1]]
you have 13 doublets; by doublet I mean a list of two elements.
So, it seems from the various comments that you want to multiply, divide, whatever, the y
component in each case.
So, first try to understand how to extract those things.
For example, focus on the first one. Try to get all the second elements from all sublists that are contained in P[[1]]
. The way to do it is
P[[1, All, 2]]
{-1.2, -1., -0.8, -0.6, -0.4, -0.2, 2.22045*10^-16, 0.2, 0.4, 0.6, 0.8, 1., 1.2}
Ok, now do whatever you want on this and recompose the list like so:
Transpose[{P[[1, All, 1]], f*P[[1, All, 2]]}]
The above has dimensions
{13, 2}
It's easy to see that in the first slot you have the original element and in the second slot the scaled one.
Then you can proceed and finish the big list of lists.
So, for instance
Table[Transpose[{P[[i, All, 1]], f*P[[i, All, 2]]}], {i, 1, Length@P}]
Is this what you wanted?
Dimensions[P]
gives{10, 13, 2}
. This is not a matrix, it is list of matrices. Are you sure this is what you want? $\endgroup$