1
$\begingroup$

So I have function (FindCoefficients) that iterates through some values to find the maximum value for a function. It is much quicker to hold the non-linear values constant and do a find maximum for the linear coeffiecients then to do a non linear optimization for a complicated function.

This is the main line that I'm struggling with:

Do[Print[a , b, FindCoefficients[a, b]], {a, 1, 10, 1}, {b, 1, 10, 1}]

This gives me the output of

11{value of maximum, other info}

12{value of maximum, other info}

13{value of maximum, other info}

...

21{value of maximum, other info}

...

1010{value of maximum, other info}

Is there any way to sort my output from greatest to smallest, so I can easily pick out the maximum?

$\endgroup$
2
$\begingroup$
SortBy[ Table[{a , b, FindCoefficients[a, b]} , {a, 1, 10, 1}, {b, 1, 10, 1}],{3}] 

sorts your Table according to the third column.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.