Brand new Mathematica user here. I have a complicated function to maximize, and thought I would try software like Mathematica instead of taking derivatives by hand. I found some Mathematica documentation and believe I've entered the code correctly. Here is my entire code:

Maximize[{(1/2)*(1/(1+2*y-y^2-x^2-2*x^2*y+2*x*y^2))*(a-c*(y^2/(-2*x^2*y^2+2*x*y^2-y^2+2*y+1)+((1+2*y-2*y^2-x^2-2*x^2*y+2*x*y^2)/y^2)*(1-1/(-2*x^2*y^2+2*x*y^2-y^2+2*y+1)))), 0<=x<=1, 0<=y<=1, 0<c<a}, {x,y}]

I believe my syntax is correct, however I'm in doubt over whether I've put my constraints in the right place. The variables $x$ and $y$ are the probabilities with which I want to maximize my function, so I "constrained" them between $0$ and $1$. And the parameters $a$ and $c$ are such that $c>0$, and $a>c$ (these are not variables -- I only want to maximize over the probabilities).

Running the script causes Mathematica to say "Running..." and never give a result. Does Mathematica have a limit on how complicated a function can be?


  • $\begingroup$ Syntactically it's fine but NMaximize won't handle it unless given specific values for the parameters a and c, $\endgroup$ – Daniel Lichtblau Aug 7 '14 at 20:49
  • $\begingroup$ Thanks for your reply! Is it not enough to specify that $c>0$ and $a>c$? Hopefully it's possible to get the solution in terms of $a$ and $c$. $\endgroup$ – Mathemanic Aug 7 '14 at 23:12
  • 1
    $\begingroup$ Did you plot your function? Moreover, for x = 1 and y = 0 it's infinite. $\endgroup$ – Karsten 7. Aug 8 '14 at 10:35
  • $\begingroup$ I believe there are cases where Minimize will handle parametrized problems. NMinimize is a numeric function and it uses numerical methods. It will not handle unspecified parameters. $\endgroup$ – Daniel Lichtblau Aug 8 '14 at 15:24

Your Answer

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

Browse other questions tagged or ask your own question.