# [Mathematica] - Finding Maximum of Function with parameters with Mathematica

#### Valen

##### New Member
How do I find the maximum of the function

in Mathematica 8?
x and y are variables and a is parameter.

Thanks in advance.

#### Dragan

##### Super Moderator
Re: Finding Maximum of Function with parameters with Mathematica

How do I find the maximum of the function

in Mathematica 8?
x and y are variables and a is parameter.

Thanks in advance.
Try using the Reduce function and set the partial derivatives both to zero and the parameter a>0.

Like this:

Reduce[{D[fxy, x] == 0 && D[fxy, y] == 0 && a > 0}, {x, y}, Reals]

I think the maximum is going to be when y = 1/(a*x) and x obviously cannot be zero. An example would be 1/e when a=1.

See if this works for you.

#### Valen

##### New Member
Re: Finding Maximum of Function with parameters with Mathematica

Try using the Reduce function and set the partial derivatives both to zero and the parameter a>0.

Like this:

Reduce[{D[fxy, x] == 0 && D[fxy, y] == 0 && a > 0}, {x, y}, Reals]

I think the maximum is going to be when y = 1/(a*x) and x obviously cannot be zero. An example would be 1/e when a=1.

See if this works for you.
It worked! Thank you!
Of course, there maybe a need to check if the zeros found are minimum
or maximum or saddle, but it is possible and I think that with the Reduce thing you showed can solve the things I need.

Thousand thanks!

#### Dragan

##### Super Moderator
Re: Finding Maximum of Function with parameters with Mathematica

It worked! Thank you!
Of course, there maybe a need to check if the zeros found are minimum
or maximum or saddle, but it is possible and I think that with the Reduce thing you showed can solve the things I need.

Thousand thanks!
Note: You can plot the function (fxy) and simply look at it to see if it's a maximum/mimiumum or a saddle:

use this, for example:

Plot3D[ fxy , {x, -1 , 1}, {y, -1, 1} ]