Skip to main content
added 164 characters in body
Source Link
E. Chan-López
  • 31.1k
  • 3
  • 29
  • 50

Grabbing the @eldo's matrix and using SubsetMap:

a = {{2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}};

SubsetMap[#/a[[All, 1]] &, a, {All, 2}]

(*{{2, 3/2}, {3, 4/3}, {4, 5/4}, {5, 6/5}, {6, 7/6}}*)

Another faster solution is the following:

Thread@{#[[All, 1]], Divide @@ Transpose@#} &@a

(*{{2, 3/2}, {3, 4/3}, {4, 5/4}, {5, 6/5}, {6, 7/6}}*)

Grabbing the @eldo's matrix and using SubsetMap:

a = {{2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}};

SubsetMap[#/a[[All, 1]] &, a, {All, 2}]

(*{{2, 3/2}, {3, 4/3}, {4, 5/4}, {5, 6/5}, {6, 7/6}}*)

Grabbing the @eldo's matrix and using SubsetMap:

a = {{2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}};

SubsetMap[#/a[[All, 1]] &, a, {All, 2}]

(*{{2, 3/2}, {3, 4/3}, {4, 5/4}, {5, 6/5}, {6, 7/6}}*)

Another faster solution is the following:

Thread@{#[[All, 1]], Divide @@ Transpose@#} &@a

(*{{2, 3/2}, {3, 4/3}, {4, 5/4}, {5, 6/5}, {6, 7/6}}*)
Source Link
E. Chan-López
  • 31.1k
  • 3
  • 29
  • 50

Grabbing the @eldo's matrix and using SubsetMap:

a = {{2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}};

SubsetMap[#/a[[All, 1]] &, a, {All, 2}]

(*{{2, 3/2}, {3, 4/3}, {4, 5/4}, {5, 6/5}, {6, 7/6}}*)