1
$\begingroup$

I want to maximize a function that has no local maximum in a certain interval. For instance, consider the function $f(x)=x$ over the interval $[0,1]$. There is no local maximum, but the maximum value of the function is clearly $1$. Here is the function that I would like to maximize: $$f(x_1,x_2,...,x_n)=\frac{1}{\Big(1-\sum\limits_{k=1}^{n}x_k\Big)^{1-\sum\limits_{k=1}^{n}x_k}\prod\limits_{k=1}^{n}x_k^{x_k}}$$

For instance, if $k=3$, we have $$f(x_1,x_2,x_3)=\frac{1}{(1-x_1-x_2-x_3)^{1-x_1-x_2-x_3}x_1^{x_1}x_2^{x_2}x_3^{x_3}}$$

I want to maximize this function with the following constraints: $$\sum\limits_{k=1}^{n}kx_k\leq 1$$ $$0\leq x_i\leq 1$$ This family of functions seems to have no local maximima when the constraints are applied. How can I work around this and find a maximal value(s)?

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Have you tried using NMaximize? For instance:

f[x1_, x2_, x3_] := 1/(Abs[1-x1-x2-x3]^(1-x1-x2-x3) x1^x1 x2^x2 x3^x3)

NMaximize[
    {
    f[x1, x2, x3],
    0<x1<1 && 0<x2<1 && 0<x3<1 && x1 + 2 x2 + 3 x3 < 1
    },
    {x1, x2, x3}
]

{3.61072, {x1 -> 0.276953, x2 -> 0.182041, x3 -> 0.119655}}

$\endgroup$
1
  • $\begingroup$ Is there a faster way to get values for different $n$? For instance, how can I make a program that uses NMaximize on values of $n$ from say, $3$ to $10$? $\endgroup$
    – 高田航
    Commented Nov 22, 2017 at 4:23

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.