# Minimum or Maximum value of a multivariate function

jkim8512
Homework Statement:
Not a hw
Relevant Equations:
Minimum or Maximum value of a multivariate function
First thank you for taking your time to take a look at this simple question. And sorry for the informal math language and equations, I hope you guys can understand it.

So, depending on the case, I have 2 or 8 simple quadratic functions f(a), f(b), f(c),… f(z).

Each a,b,c,…,z have a different range for f(a),f(b), f(c), .. ,f(z). These functions are all independent to each other, they are just simple quadratic functions.

These functions adds up to get one value f(T).

The constraint is that the sum of a,b,c,…,z should be a given value N.

And what I want is the Minimum or maximum value of f(T)

So, If I right it down in some simple math, it looks like this.

f(T) = f(a) + f(b) + f(c) + f(d)+….+f(z)

constraint: N = a+b+c+d+….+z

goal: Find minimum or maximum value of f(T) when N is given.

where,

f(a) = simple quadratic function such as 3a^2+ 4a+ 5, range: a_start < a < a_end

f(b) = simple quadratic function such as 3b^2+ 4b+ 5, range: b_start < b < b_end

f(c) = simple quadratic function such as 3c^2+ 4c+ 5, , range: c_start < c < c_end

………… same up to f(z)

I googled some stuff and found I could probably use “Max/min for functions of multi variables” things like that.

The main problem I can’t figure out is how to deal with the constraints I need to have regarding N=a+b+c,..+z

Thanks again!

Delta2

Staff Emeritus
Gold Member
Your notation is pretty bad, it would be a lot clearer if your wrote ##f(x_1,...,x_n) = f_1(x_1)+...+f_n(x_n)##.

The thing you need to use to incorporate the constraint is lagrange multipliers.

https://en.m.wikipedia.org/wiki/Lagrange_multiplier

Basically the idea is that gradient of the function you are minimizing has to be parallel to the gradient of the constraint.

Delta2 and jkim8512
jkim8512
Your notation is pretty bad, it would be a lot clearer if your wrote ##f(x_1,...,x_n) = f_1(x_1)+...+f_n(x_n)##.

The thing you need to use to incorporate the constraint is lagrange multipliers.

https://en.m.wikipedia.org/wiki/Lagrange_multiplier

Basically the idea is that gradient of the function you are minimizing has to be parallel to the gradient of the constraint.

Thank you so much. It seems like the right thing to look at.

berkeman
Mentor
You can have a look at the LaTeX Guide link in the lower left of the Edit window to see how to best post math equations online...

jkim8512
jkim8512
Your notation is pretty bad, it would be a lot clearer if your wrote ##f(x_1,...,x_n) = f_1(x_1)+...+f_n(x_n)##.

The thing you need to use to incorporate the constraint is lagrange multipliers.

https://en.m.wikipedia.org/wiki/Lagrange_multiplier

Basically the idea is that gradient of the function you are minimizing has to be parallel to the gradient of the constraint.
First thank you all for the kind reply.

I took a look into Lagrange multipliers. It seems like what I need to use.

However I still have one question. I am not sure about how to limit the range for x1,x2, x3, … ,xN

I want to find

Max/min of: f(x1,x2,…,xn) = f1(x1) + f2(x2) +... +fn(xn)

Constraint: x1+x2 +...+xn =N

X1 range: x1_start < x1 <x1_end

X2 range: x2_start < x1 <x2_end

......

X3 range: xn_start < xn <xn_end

I googled how to use the contraint by using the Lagrange multipliers. And I think i can do it.

But, I still don’t know what to do with the ranges for x1, x2, ... ,xn. Can you guys give me any hint for it or tell me what i have to look into?

Thanks!

Have a wonderful weekend!

Homework Helper
2022 Award
You are trying to extremize $$f(x_1, \dots, x_n) = \sum_{i=1}^n f_i(x_i)$$ subject to $x_1 + \dots + x_n = N$ and $m_i \leq x_i \leq M_i$ for $i = 1, \dots, n$. The equality constraint can be enforced by using a lagrange multiplier and extremizing instead the function $$F(x_1, \dots, x_n, \lambda) = f(x_1, \dots, x_n) + \lambda\left(\sum_{i=1}^N x_i - N\right).$$ It looks like an Interior point method might work to maximize $F$, since that will also enforce contraints of the form $$c_{2i-1}(x_1, \dots, x_n,\lambda) = x_i - m_i \geq 0$$ and $$c_{2i}(x_1, \dots, x_n, \lambda) = M_i - x_i \geq 0,$$ ensuring that the extrema are in the acceptable range of $x_i$.