Skip to main content
added 119 characters in body
Source Link
Three Diag
  • 695
  • 4
  • 13

Say I am tabling the values of a two variable function using a list of indexes (which I can't assume to be ordered), I'd like to return the index (or the list of indexes) which yield the maximum value(s) for one of the two arguments (supplying the other one externally.

indexes = {1,5,19,3,2,14};
f[x]f[x_,y_] := someFunc[x];someFunc[x,y]; 
(* Just a place holder, any function returning integers should do, if there are multiple maxima I'd like a list in return and I'll break ties later. *)
Table[ArgMax[Table[ f[x]f[x,y],{x,indexes}];]];

Say I am tabling using a list of indexes (which I can't assume to be ordered), I'd like to return the index (or the list of indexes) which yield the maximum value(s).

indexes = {1,5,19,3,2,14};
f[x] := someFunc[x]; 
(* Just a place holder, any function returning integers should do, if there are multiple maxima I'd like a list in return and I'll break ties later. *)
Table[ f[x],{x,indexes}];

Say I am tabling the values of a two variable function using a list of indexes (which I can't assume to be ordered), I'd like to return the index (or the list of indexes) which yield the maximum value(s) for one of the two arguments (supplying the other one externally.

indexes = {1,5,19,3,2,14};
f[x_,y_] := someFunc[x,y]; 
(* Just a place holder, any function returning integers should do, if there are multiple maxima I'd like a list in return and I'll break ties later. *)
ArgMax[Table[ f[x,y],{x,indexes}]];
Source Link
Three Diag
  • 695
  • 4
  • 13

Getting the index of maximum while generating the values with table

Say I am tabling using a list of indexes (which I can't assume to be ordered), I'd like to return the index (or the list of indexes) which yield the maximum value(s).

indexes = {1,5,19,3,2,14};
f[x] := someFunc[x]; 
(* Just a place holder, any function returning integers should do, if there are multiple maxima I'd like a list in return and I'll break ties later. *)
Table[ f[x],{x,indexes}];