I have a cost function with 2 parameters. The variables are dependent on each other. So, if I just take a partial derivative with respect to one variable the slope is in terms of the other variable and vice-versa. So, how can I compute the optimal values for these variables that minimize my cost function?

  • 10
    $\begingroup$ It would be useful if you could show your problem in formulas. $\endgroup$ Apr 10, 2019 at 14:17
  • 2
    $\begingroup$ I concur, please provide the actual formulas. $\endgroup$
    – MPIchael
    May 16, 2019 at 14:43

1 Answer 1


What you have appears to be a non-linear function which you are trying to optimize. Whilst not as trivial as linear optimization it is not particularly difficult either. Since numerically you aren't working with symbolic variables but always with numbers (arrays of numbers called vectors) which are computed at each step of the optimization process anew, to adapt to the parameters being considered.

I'd suggest you open a book on numerical analysis at the chapter treating non-linear optimization. One method to try would be gradient descent, but there are better variations.


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.