Transform user-defined function to the different function
calculating Max / Arg Max of the input function
