Hi I was looking how to operate in just one subelement of a matrix or kind of list, this is what I want:
I have the next Matrix:
a1 = {{1, 43}, {123, 54}, {124, 78}}
I need to operate the first subelement of each element for example if I want to multiply by two, the expected out will be
={{2,43},{246,54},{248,76}}
And if its possible to aply a function to the first subelement of each element. For example imagine I have defined a function as follows:
g[h_, j_] :=(100 h)/j
I want the next
{{g[1, 1],43},{g[123, 1],43},{g[124, 1],78}}
Of course I could make it manual but I have many many lists or matrix as you can call them.
My attempt was as follows:
Do[Print[ReplacePart[a1, {i, 1} -> g[a1[[i, 1]], 1]]], {i, 1, 3}]
{{100,43},{123,54},{124,78}}
{{1,43},{12300,54},{124,78}}
{{1,43},{123,54},{12400,78}}
Almost made it, but a just need the elements of the diagonal matrix if you have another program or another way to operate on each element but not in all i would appreciate it a lot.
In conclusion I want to opearate in one subelements of each element generating a new list not remplacing the existent.
Greetings.