Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have data in the following form , where x is an integer and r is 0 or 1.

I know that

  • if $x < C$, then $r = 1$,
  • if $x\geq C$, then $r= 0$.

How can I automatically estimate the value of $C$? Can I have any guarantees on the convergence?

There must be an easy way to solve this, I just cannot find out!

share|cite|improve this question

If you have no idea to start with, you could start checking $1, 2, 4, \ldots 2^n$ until $r$ drops to zero. Then you can use the bisection method of root finding to find the actual value. Basically it takes the range that you know the transition is in, bisects it, and reduces the range appropriately. Say $f(32)=1$ and $f(64)=0$. Check $f(48)$. If it is $1$, your range is now $(48,64]$. If it is $0$, your range is now $(32,48]$. Keep going this way.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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