- #1
nazmul.islam
- 2
- 0
Hello,
I have an array of length M. Some of the indices are non-negative. I need to derive a function/analytic expression (preferably linear or convex) that finds the span of indices for which the indices are non-negative.
Example: Let p denote the desired vector.
Let, p = [0 0 0.3 2.6 0 0 1.1 0 1.8 0]
There are 10 elements in the array. Non-negative numbers start from index 3 (0.3) and end at index 9 (1.8). Range/span of non-negative numbers = 9-3+1 = 7.
I need a linear/convex function/analytic expression that can find this number.
Previous work:
I have already derived a similar function if the array only contains binary numbers.
Example: let, x = [0 0 1 1 0 0 1 0 1 0].
Now, let M denote the set of indices of x, i.e., M = {1,2,3,...,10}. Assume that x_m denotes the
m-th entry of the array x. For example, x_2 = 0, x_3 = 1. Here, |M| = 10.
My derived function (written in Latex format),
f(x) = max_{m \in M} (m * x_m) - min_{m \in M} (m * x_m + |M| (1 - x_m)) + 1
= max (1 * x_1, 2 * x_2, ..) - min (1 * x_1 + 10 * (1 - x_1), 2 * x_2 + 10 * (1 - x_2), ...) + 1
= 9 - 3 + 1
= 7.
This function is convex and it provides the correct answer. However, it only works for arrays that consist of binary numbers.
I need to find a linear/convex function/analytic expressions which work for arrays that consist of any non-negative number. This function will go into a constraint of my optimization problem. Hence, linearity/convexity is required. However, even a non-linear/non-convex function may help me, too.
Any ideas? Thanks a lot for reading this message. Let me know if I should post it in a different sub-forum of the math forum.
Thanks,
Nazmul
I have an array of length M. Some of the indices are non-negative. I need to derive a function/analytic expression (preferably linear or convex) that finds the span of indices for which the indices are non-negative.
Example: Let p denote the desired vector.
Let, p = [0 0 0.3 2.6 0 0 1.1 0 1.8 0]
There are 10 elements in the array. Non-negative numbers start from index 3 (0.3) and end at index 9 (1.8). Range/span of non-negative numbers = 9-3+1 = 7.
I need a linear/convex function/analytic expression that can find this number.
Previous work:
I have already derived a similar function if the array only contains binary numbers.
Example: let, x = [0 0 1 1 0 0 1 0 1 0].
Now, let M denote the set of indices of x, i.e., M = {1,2,3,...,10}. Assume that x_m denotes the
m-th entry of the array x. For example, x_2 = 0, x_3 = 1. Here, |M| = 10.
My derived function (written in Latex format),
f(x) = max_{m \in M} (m * x_m) - min_{m \in M} (m * x_m + |M| (1 - x_m)) + 1
= max (1 * x_1, 2 * x_2, ..) - min (1 * x_1 + 10 * (1 - x_1), 2 * x_2 + 10 * (1 - x_2), ...) + 1
= 9 - 3 + 1
= 7.
This function is convex and it provides the correct answer. However, it only works for arrays that consist of binary numbers.
I need to find a linear/convex function/analytic expressions which work for arrays that consist of any non-negative number. This function will go into a constraint of my optimization problem. Hence, linearity/convexity is required. However, even a non-linear/non-convex function may help me, too.
Any ideas? Thanks a lot for reading this message. Let me know if I should post it in a different sub-forum of the math forum.
Thanks,
Nazmul