I am new to mathematica and this is my first question, so please forgive me if it is something trivial. I am solving a maximisation problem, and my foc is the following:

focsm = g (sg^2 + sm (-2 + 2 fg + 4 fm + 3 sm) + sg (-1 + fg + 3 fm + 4 sm)) + B[1 - fg - fm - sg - sm] - (fm + sm) Derivative[1][B][ 1 - fg - fm - sg - sm]

As you may notice, it involves the function B[.] and its derivative. Now, for me B[.] is a generic function, with first derivative positive and second derivative less or equal than zero. I need to impose the foc equal to zero, and solve for sm (or alternatively fm). I tried with the command Solve, but it doesn't work.

Solve[focsm == 0, sm]

If I give a functional form to B[.] (for example linear), everything works. How can I solve this?


1 Answer 1


This is because the variable sm occurs in the function B, therefore Mathematica must know about the values the function takes. A simpler version of this can be seen in

  • $\begingroup$ Thank you a lot, your example clarify everything. Then, is there any solution to this, besides specifying a functional form? I would like to keep the problem as general as possible. $\endgroup$ Apr 18, 2020 at 9:17
  • $\begingroup$ There is no general solution unfortunately because, in the simplest case, solving $f(x) + g(x) = 0$ depends entirely on $f$ and $g$. $\endgroup$
    – dusky
    Apr 18, 2020 at 22:15
  • $\begingroup$ Thanks a lot, you cleared my doubts. $\endgroup$ Apr 19, 2020 at 13:20

Your Answer

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

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