Suppose I have two functions f(x,y)=1 + 2*x +3*y^3 and g(x,y)=y + x^2. I want to have maximum function of {f(x,y)+g(x,y), f(x,y)*g(x,y)} on 0<=x<=1. For example to two functions of one variable: I need criterion of green function in the following picture: enter image description here

I want to create a new function, such as h[x_,y_]:=Max[f[x,y]+g[x,y],f[x,y]*g[x,y]]

  • 2
    $\begingroup$ Neither your functions nor your goals are clear. What is t? What does "have maximum function" mean? Do you want to create a new function, such as h[x_,y_]:=Max[f[x,y]+g[x,y],f[x,y]*g[x,y]]? Or do you want a function of y given constrained maximization over x? Or do you just need to graph something? $\endgroup$
    – Alan
    Nov 6, 2019 at 17:33

1 Answer 1


I think you are asking for something like the following. Define the functions f and g

f[x_, y_] := 1 + 2*x + 3*y^3
g[x_, y_] := y + x^2

Define a function that finds the maximum as a function of y. I can't see an easy way to do this for symbolic values of y, so I define a function that evaluates only when given a numerical value.

h[y_?NumericQ] := 
 MaxValue[{Max[f[x, y] + g[x, y], f[x, y] g[x, y]], 0 <= x <= 1}, x]

As a check, compute a table of values

Table[{y, h[y]}, {y, 0, 1, 1/4}]
(* {{0, 4}, {1/4, 275/64}, {1/2, 81/16}, {3/4, 1911/256}, {1, 
  12}} *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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