2
$\begingroup$

I have an equation to compute the bit-error rate of a binary symmetric channel: $$P_{err}(n,p) = \sum_{k = \frac{n-1}{2} + 1}^n\binom n k p^k(1-p)^{n-k}$$

I then want to find the smallest $n$-repetition code assuming that I can tolerate $P_{err}\leq\frac{1}{8}$. I tried using:

Subscript[P, err][n_, p_] = 
  Sum[Binomial[n, k]*p^k*(1 - p)^(n - k), {k, (n - 1)/2 + 1, n}];

FindInstance[Subscript[P, err][n, 1/4] < 1/8, n, Integers, 5]

But I'm getting {{n -> 555}, {n -> 1165}, {n -> 887}, {n -> 831}, {n -> 1119}} as the answer. However,

Table[{n, Subscript[P, err][n, 1/4] < 1/8}, {n, 1, 10, 2}]

Gives me {{1, False}, {3, False}, {5, True}, {7, True}, {9, True}}, showing that 5 is the first solution.

Why is this happening and how can I fix this? I'm assuming this must be something to do with the way FindInstance reacts to values of n that are even - any way to limit the search space to only odd numbers?

$\endgroup$
4
$\begingroup$

Restrict the range to find small solutions:

n /. FindInstance[Subscript[P, err][n , 1/4] < 1/8 && 0 < n < 10, n, 
  Integers, 50]

{5, 6, 7, 8, 9}

Find only odd:

(2 n + 1) /. 
 FindInstance[Subscript[P, err][2 n + 1, 1/4] < 1/8 && 0 < n < 10, n,
   Integers, 50] // Sort

{5, 7, 9, 11, 13, 15, 17, 19}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.