i am trying to find the Maximum difference between two matrices and identify where this maximum occurs.
I illustrate what I mean using an example. Given
X={{3, 1}, {8, 2}, {10, 3}}
Y={{5, 1}, {4, 2}, {5, 3}}
I calculate matrix which has (X-Y) and position as entries, specifically
d={{-2, 1}, {4, 2}, {5, 3}}
As out pout I would like to have
{5,3}
What is the best way to code this?
Ordering[Abs[X[[All, 1]] - X[[All, 2]]], -1][[1]]
should give the the position3
. The value of the difference can than be found easily. $\endgroup$