Seeking a 3 variable function with a specific property

30 Views Asked by At

I'm looking for a function $f(x_1,x_2,y)$ which has the following property.

$y \in [0,1]$, $x_1,x_2>0$.

The minimum value of $f(x_1,x_2,y)$ is $max(x_1,x_2)$ at $y=1$;

The maximum value of $f(x_1,x_2,y)$ is at $x_1+x_2$ at $y=0$;

The function should preferably use only math operations,(not functions like max,min,abs).

One example would be (using max and min) will be):

$f(x_1,x_2,y)=max(x_1,x_2)+(1-y)*min(x_1,x_2)$

3

There are 3 best solutions below

0
On

For $x_1,x_2>0$ one can prove that $$\max(x_1,x_2)=\frac{x_1+x_2+\sqrt{(x_1-x_2)^2}}{2}\quad\text{and}\quad\min(x_1,x_2)=\frac{x_1+x_2-\sqrt{(x_1-x_2)^2}}{2}$$ Hence we can take a function such as $$f(x_1,x_2,y)=\frac{(2-y)(x_1+x_2)+y\sqrt{(x_1-x_2)^2}}{2}$$

0
On

I don't think that computing the function $\max$ with a finite number of the four basic operations is possible.

As in the post by @MarioG, if the square root is allowed, you can obtain the absolute value from $|x|=\sqrt{x^2}$, and the absolute value gives you access to the maximum with $\max(x_1,x_2)=\frac12(x_1+x_2+|x_1-x_2|)$.


The $\max$ function is piecewise linear and has singularities along the line $x_1=x_2$ where the derivatives are discontinuous.

On the other hand, the only functions that you can build out of $+-\times\div$ are the so-called rational fractions, i.e. the ratio of two polynomials. Such functions are smooth, with possible asymptotes, but they are unable to produce discontinuities in the derivative where they take finite values.

Allowing the powers opens more possibilities, as these can introduce discontinuities.

0
On

Here is a more complicated function which is $max(x_1,x_2)$ at $y=0$ and $x_1+x_2$ at $y=1$: $$(x_1^{1/y}+x_2^{1/y})^y$$