(i_1,i_2)= i mod 2  for example (0,1)=1 mod 2 or (1,1)=3 mod 2

$$f_i(s_0,s_1)={s_0}^{i_1}{s_1}^{i_2}{(1-s_0)}^{1-i_1}{(1-s_1)}^{1-i_2}$$ $$r(s_0,s_1,x_1,k_1)=\sum_{i=0}^{2^n-1} \min(f_i(s_0,s_1),f_{2^n-i-1}(y(s_0;x_1,k_1),y(s_1;x_1,k_1)))$$ $$y(x;x_1,k_1)=\begin{cases}\frac{-1+k_1(1-x_1)}{x_1}x+1,\quad x\in[0,x_1]\\k_1(-x+1),\,\quad\quad\quad x\in[x_1,1]\end{cases}$$ and $$\begin{cases}y\in[k_1,1],\quad\quad\quad\quad x_1=0\\x\in[x_1,1],\quad\quad\quad\quad k_1=0\end{cases}$$

I want to solve


Please excuse me that I have no codes because I dont know too many things:

$1.$ Defining the function $y$ properly in Mathematica

$2.$ To make a minimax type optimization

$3.$ To obtain binary expansion of a number

  • $\begingroup$ If you want to define y you can potentially use Piecewise. Dunno if that will be best, though. $\endgroup$
    – b3m2a1
    Commented Jul 25, 2018 at 21:44
  • $\begingroup$ @b3m2a1 I have used that a few times.. Here the point is that the function takes all values from $k_1$ to $1$ if $x_1$ is zero. Similarly if $k_1=0$ then $x$ takes all values in $[x_1,1]$. So for all other values it is just a simple convex function but for $x_1=0$ and $k_1=0$ there are multiple values. $\endgroup$ Commented Jul 25, 2018 at 22:35

1 Answer 1


Just use this function to get binary digits:

BaseForm[58, 2]

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.