Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

I would like to know if there is a way to determine/recognize a irrational number by computers. Let me explain it a little more. I know that, in computer science, a computable number "a" is a number that can be approximated by two rational number, i.e. (k-1)/n<=a<=(k+1)/n where k&n are in N. Also, due to the limitation of floating point, all numbers in computers have limited number of significant figures. So, I was wondering if there is a way (more like an algorithm) to define irrational number for computers and consequently detect irrational number? Off course, I'm talking about an approximation with some adjustable level of accuracy. Thanks

share|improve this question
3  
"...floating point, all numbers in computers..." Floating point is not the only way to represent numbers. Integers are naturally there (up to some limiting size), rationals can be handled with infinite precision as a pair of integers, quadratic irrationals can be handled by their continued fraction, algebraic numbers can be handled by manipulating their minimal polynomials, etc. Programs like Sage and Mathematica can handle e, pi, and many other common transcendentals formally, thereby maintaining infinite precision. –  Kevin O'Bryant Mar 22 '12 at 17:15

1 Answer 1

Generate the continued fraction for the number. If it has a suspiciously* large number, truncate just before it: it's probably rational. Otherwise it's either irrational or rational with a large denominator; you can't easily tell the two apart.

Of course since both rationals and irrationals are dense in the reals you can never know for sure with just an approximation, but this is a useful technique that often works in practice.

* This can be made more precise using the Gauss-Kuzmin distribution. But you can probably just eyeball it.

share|improve this answer

Your Answer

 
discard

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.