Jump to content
  • Advertisement
Sign in to follow this  
JohnnyCode

every number in computer is rational?

This topic is 1826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You may answer right away with, yes, rounding to limited amount of digits means a rational number. My question is rather, wheather a number defined as a pair of two integrated numbers, would be sufficient datatype for real numbers computations. As I believe there is no sets of operations in a computer that would provide a real number without first deviding some numbers, or, defining a constant. If this is true, wouldnt this be a data type faster to operate on than IEEE floatings? I believe that even sqrt(2) is doing operations that would relate in this datatype. Put simply, +,-,*,/ operations cannot provide irrational number.

Share this post


Link to post
Share on other sites
Advertisement

My question is rather, wheather a number defined as a pair of two integrated numbers, would be sufficient datatype for real numbers computations.

 

If you mean a pair of numbers that are taken as a quotient such as the pair {p, q} used to implicitly represent the value (p / q)...this is still considered a rational number.  There are indeed math libraries that use such a representation.  An irrational number is one that requires an infinite amount of precision to store exactly.  As far as I know it is not possible to build a computing device that is not limited to rational numbers.

Share this post


Link to post
Share on other sites

The most common examples of this type of computing and calculating is Wolfram and Mathematica stuff. Take WolframAlpha for example. It can work with equations and known constants (like pi, for example) and produce exact results. It can also give you a decimal form of the exact result (and you can request an arbitrary number of digits from this irrational result). Here's an example of a computation done using irrational numbers that it computes the exact result for. If you want a decimal value instead of a the exact result (10 * sqrt(2) * pi), it can compute an arbitrary number of decimal points (and with the pro version of Wolfram's software, it can be as long as you want). If you click the answer, it'll give you this, and you can just keep requesting more and more digits.

 

Indeed but does this really count?  It's essentially a form a symbolic manipulation where your input is algebraically simplified as much as possible, the simplified form can then be queried for an arbitrarily precise results...the underlying number crunching still uses a finite representation.

Share this post


Link to post
Share on other sites

Indeed but does this really count?  It's essentially a form a symbolic manipulation where your input is algebraically simplified as much as possible, the simplified form can then be queried for an arbitrarily precise results...the underlying number crunching still uses a finite representation.

The only limits are 1) how long you want to wait for a result and 2) how much memory you have, pretty much. The thing is, it's impossible to compute some numbers without doing some mathematical function (division, for example, or erf). Heck, we can't even truly write the value of 1/3 in decimal, and it's a rational number. If you want decimal digits (and no mathematical function, like division), you have to approximate it (or else you'll run out of atoms in the universe before you can represent the exact value).

 

So if you want exact results, you have to do things symbolically. Even storing numbers in memory as a/b (where a and b are integers in some structure) is a form of symbolic algebra (to a degree, at least).

Edited by Cornstalks

Share this post


Link to post
Share on other sites

Indeed but does this really count?  It's essentially a form a symbolic manipulation where your input is algebraically simplified as much as possible, the simplified form can then be queried for an arbitrarily precise results...the underlying number crunching still uses a finite representation.

Depends on whether you choose to count algebraic simplification as number crunching or not.
 
A maths tool like wolfram alpha can tell me that sqrt(2) * sqrt(2) is exactly equal to two. A numerical library using floats will tell me that it's 1.9999999.
Using some definitions, the first hasn't done "number crunching", but that doesn't matter, as it's damn well more intelligent, and actually correct! It's also done a hell of a lot more "number crunching" using other definitions, such as the amount of compute time consumed in finding that answer wink.png

 

Also, with that Pi example, you can construct other equations where instead of trying to give you a finite decimal answer, wolfram will give you an exact irrational answer, like Pi/3.

e.g. integrate sin(x) Pi dx where x is 0 to Pi == exactly 2Pi or approximately 6.28319...

[edit]

I didn't realize that cornstalk's example already did give a precise irrational answer of 10*Pi*Sqrt(2)... There would have been significant calculation involved in it finding that exact answer. Yes, if you want to view it as a decimal fraction, you'll get an approximate finite representation, but there's no reason that you have to choose to request that representation...

 

Numbers can be represented in infinitely different ways. "2*Pi" is no lesser than "6.28319", simply because it uses different symbols. They're both numbers just different ways of writing down the same number. The former is an exact specification of that number, and the latter is an approximation of it.

There's nothing special about base-10, or base-2, or base-16 (decimal/binary/hex) as ways of writing numbers. E.g. 1/3rd cannot be precisely written in decimal (0.3...), 1/10th cannot be precisely written in binary (0.000110011...), etc...

Edited by Hodgman

Share this post


Link to post
Share on other sites

You are still limited to representing computable numbers (i.e. numbers for which there is an algorithm which will output the nth digit of the number [in some base] in a finite number of steps).

 

There are only a countably infinite number of algorithms (since you can give each algorithm a Godel numbering, which maps an algorithm to an integer), however there are an uncountably infinite amount of real numbers, therefore:

 

almost all real numbers are not computable numbers (i.e. if you picked a real number completely at random, the probability that there is an algorithm that will be able to produce the nth digit in a finite number of steps is zero).

 

EDIT: In other words, if you have any interval [a, b] of real numbers, where a < b, then the interval contains only countably many [although infinite] computable numbers, but an uncountably infinite number of uncomputable numbers.

 

The following sets are all countably infinite:

 

Natural numbers {1, 2, 3, ...}

Integers {..., -2, -1, 0, 1, 2, ...}

Rational numbers {p/q: p, q integers}

Algebraic numbers {x: x is a root of a polynomial with rational coefficients} (e.g. sqrt(2) which is a root of y = x2 - 2) EDIT: Note, not all roots of polynomials can be generated using +, -, *, / and extracting of nth roots, e.g. x5 - x + 1 = 0, see Abel-Ruffini Theorem http://en.wikipedia.org/wiki/Abel%E2%80%93Ruffini_theorem

Computable numbers

 

Each set in that list is a subset of the sets below it in the list. Computable non-algebraic numbers include e, pi. A number is called transcendental if it is not algebraic.

 

The set complement of those sets in the reals (or the complement of those sets in any real interval) are all uncountably infinite.

Edited by Paradigm Shifter

Share this post


Link to post
Share on other sites

My question is rather, wheather a number defined as a pair of two integrated numbers, would be sufficient datatype for real numbers computations.


Regardless of what "integrated numbers" means, the answer is no. Any representation of data in a computer is a finite string of bits. There are only countably many finite strings of bits, but there are many more real numbers (as Paradigm Shifter said, and Cantor before him), so nothing you can do in a computer can be "sufficient datatype for real numbers computations".

Share this post


Link to post
Share on other sites

Well you could use an analogue computer but then you wouldn't be able to extract a numeric representation of the number without rounding, and when you round a number you convert it to the nearest rational number to the actual number within some arbitrary small interval.

 

EDIT: Regarding the opening post,

 

Put simply, +,-,*,/ operations cannot provide irrational number.

 

this is correct, given rational inputs you cannot produce an irrational number as output since the rational numbers are closed under the operations of +, -, * and division by a non-zero rational (they form a field). You can form a field of fractions from any integral domain (which is a ring which does not have proper divisors of zero i.e. if a, b are members of an integral domain then ab = 0 if and only if a = 0 or b = 0).

 

There are operations which can produce irrational numbers from rational numbers e.g. taking nth roots, and operations involving limits being 2 examples.

Edited by Paradigm Shifter

Share this post


Link to post
Share on other sites

Well you could use an analogue computer but then you wouldn't be able to extract a numeric representation of the number without rounding, and when you round a number you convert it to the nearest rational number to the actual number within some arbitrary small interval.


There is a more fundamental objection to using any computer to represent real numbers: We know from quantum mechanics that the amount of information in the observable universe is finite, which means that a single real number contains more information than what can be held in any computer you may ever build.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!