# Finding minimum of a symbolic function [closed]

Why does Mathematica fails to find the minima of the two variable function with real coefficients. The function and my attempt is given below.

Input:

 FindMinimum[
a (x - vh^2/2)^2 + b (y - vs^2/2)^2,  {a, b, vh, vs} \[Element]
Real]


output:

FindMinimum::ivar


Note that I want a minimum w.r.t to both x and y. Any suggestions, please.

How if the a,b -> \sqrt[a], \sqrt[b] ?

• You didn't mentioned you get the FindMinimum::ivar error. The community expects: ✅: A clear description of an on-topic problem or goal. ✅: A minimal working Wolfram Language code example, formatted, easy to copy&paste. ❌. An example of what you expect as output. ❌. Some proof of minimal Mathematica knowledge. ❌. Minimum due diligence: Share how you have searched the site and documentation, your attempts and reasons to believe an answer exists. Dec 2, 2022 at 12:52
• Maybe Minimize[ a (x - vh^2/2)^2 + b (y - vs^2/2)^2 + c (x - vh^2/2) (y - vs^2/2), {x, y}] Dec 2, 2022 at 12:57
• We only need to consider a*u^2+b*v^2+c*u*v. Dec 2, 2022 at 13:20

As mentioned by Ulrich Neumann (+1), the correct function for what you want is Minimize, not FindMinimum, see below why your attempt didn't work.

# Solution

You can use Minimize, but unless you constraint the values for your variables (In this case using Assuming), you get a very complicated expression. Here I show you the simplest case for positive parameters and $$4 a b >c^2$$:

Assuming[
And[
{a, b, c, vh, vs} ∈ PositiveReals,
4 a b > c^2
],
FullSimplify@Minimize[
a (x - vh^2/2)^2 + b (y - vs^2/2)^2 +  c (x - vh^2/2) (y - vs^2/2)
, {x, y}
]
] Your code didn't work for many reasons:

• Nice answer! Do you know how mathematica find these minima? Dec 2, 2022 at 13:18
• I want to know the underlying method where mathematica us first or second order derivative or without it. Dec 2, 2022 at 13:19
• @SciJewel No, we don't know in detail how is done, the documentation doesn't say and TracePrint doesn't reveal anything useful. In general Wolfram doesn't disclose implementation details. Presumably, it does something similar you would do, solving for derivative roots. Dec 2, 2022 at 13:50
• Do you also find another minimum as I do for 4 a b == c^2. In this case I find different terms for x and y. If I change the order of the variable that is, Minimize[f{x,y}, {x,y}] and Minimize[f{x,y}, {y,x}], the minima are different and interchanged. Dec 2, 2022 at 14:44
• When I use \sqrt[a], \sqrt[b] instead of a, b, it cannot find find the solutions. I even changed the assumption to \sqrt[a], \sqrt[b] as Positive reals. Still, doesn't work. could you please check it. Thanks Dec 16, 2022 at 12:50

FindMinimum expects numerical input, try Minimize:

mini=Minimize[a (x - vh^2/2)^2 + b (y - vs^2/2)^2 + c (x - vh^2/2) (y - vs^2/2), {x, y}]

Simplify[mini, a > 0 && b > 0 && c > 0]
` gives minimum -Infinity if 4 a b <c^2 and several other solutions.

• It cannot be infinity. Dec 2, 2022 at 13:03