Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Can we represent every possible number using binary?

Author
Message
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 7th Mar 2012 06:38
So I've just started a Computer Science course and the lecturer presented this question for discussion: "Can we represent every possible number using binary?" He gave us four answers
a) Yes
b) No
c) It depends
d) Everything except 0

Theoretically, yes you could but in the context of computers I answered no, my reason being that as numbers increase, computers would eventually run out of space (memory or storage) to hold them. Apparently the correct answer is yes but I didn't quite make out the reasoning as everybody began talking at that point. Either way, I'm curious to hear what you guys say. What do you think?

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 7th Mar 2012 06:58 Edited at: 7th Mar 2012 07:00
You can't represent every possible integer in binary using only a constant, nonchanging, finite number of bits, but you can find a finite representation in binary for any integer!

It's like countability. The natural numbers are considered countable because you can list them off sequentially: One, Two, Three, Four etc. This doesn't mean that you can list all of them off, it just means that you can assign a set position for every natural number. So 1 is at the first position, 2 is at the first position, and 10^10^10^10^10^999 is at the 10^10^10^10^10^999th position.

[edit]
heheh, but I guess it depends on what the question was asking. If you have 100 bits you obviously can't represent every possible number. Your answer is right but I think that - at least from the teacher's point of view - it's your interpretation of the question that's wrong.

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 7th Mar 2012 07:03
Yah, it is possible to store any number possible, binary is base 2 where our regular counting system is base 10, and both are able to go on infinitely... As you said, computers would eventually run out of space. However, certain algorithms could be used to turn a smaller number into a much larger one, like using scientific notation where you would have something like 1.2862895e25 which would represent 12,862,895,000,000,000,000,000,000. Therefore, theoretically not only can binary store infinite values, a computer can too. However you may have noticed the digits after the numbers listed in the scientific notation were all zero. That is one limitation there... as far as i know, these numbers represented in this form (floating point numbers) have a precision value that represents how many digits you can have that are not zeros, essentially.

Copyrightz © 2012 dbd79
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 7th Mar 2012 07:39
Quote: "You can't represent every possible integer in binary using only a constant, nonchanging, finite number of bits, but you can find a finite representation in binary for any integer!"

That's a very good way of saying it Neuro. One of my class mates was trying to convince me that it was 'yes' but I think we were looking at the question in different interpretations, as you've said.

Quote: "As you said, computers would eventually run out of space."

Quote: " Therefore, theoretically not only can binary store infinite values, a computer can too."

You've kind of lost me here DBD79, I'm afraid I don't quite understand the theoretical bit. Even with algorithms in place, wouldn't computers eventually hit a limit?

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 7th Mar 2012 07:53
Quote: "Even with algorithms in place, wouldn't computers eventually hit a limit?"
I suppose i might have confused you there! Indeed, they would, but they can still represent VERY large number ranges...

Copyrightz © 2012 dbd79
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 7th Mar 2012 08:12
Quote: "I suppose i might have confused you there!"

Just a little .

Quote: "Indeed, they would, but they can still represent VERY large number ranges..."

That is true.

I have another question somewhat related to binary numbers, how is accuracy lost with floating point numbers? An interesting example:

In DBP:


This will output 123.45 as expected but in AGK


This will output 123.449997. I'm curious as to how that little bit of accuracy is lost.

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 7th Mar 2012 08:21
Strange! Not sure what causes that!

Copyrightz © 2012 dbd79
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Mar 2012 08:24
It depends how you define "number". You can never represent the number 0.1 using a binary system....

1
0.5
0.25
0.125
0.0675
etc
etc

...never gives you a combination of decimal values that will represent 0.1

That's also the reason why you lose accuracy in your additional question above.

bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 7th Mar 2012 12:52 Edited at: 7th Mar 2012 12:57
Quote: "It depends how you define "number". You can never represent the number 0.1 using a binary system...."


With a fixed point and a couple bytes you could.

0000 . 0001

could go from 0 to 15.15

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Mar 2012 14:00
To be fair, computers aren't mentioned in the question, so you were wrong.

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.
BiggAdd
Retired Moderator
20
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 7th Mar 2012 14:10 Edited at: 7th Mar 2012 14:11
I'd say yes. Binary is just a format. A byte can mean as many things as you want it to.
Binary can theoretically represent anything you want it to, but whether or not you want to perform calculations on your "number" would determine if binary could represent complex/irrational numbers.

So I'd go with c) It depends on whether the number needs to be computable.
But I would be interested to hear why the correct answer is a).
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 7th Mar 2012 15:52 Edited at: 7th Mar 2012 16:00
You can represent any integer in a finite number of bits.
You can represent any rational number in a finite number of bits.
You need an infinite number of bits to be able to represent any irrational number.

You can represent anything that is countable with a finite number of bits. Integers and rational numbers are countable, but numbers in general are not.

However, it is possible to represent any useful number in a finite number of bits, since we have a countable number of "useful" irrational numbers like "pi" and "e" which we know about, and we have a countable number of operations we can do to produce an irrational number (trig functions, roots, etc.), and it is the case that any countable union of countable sets is also countable.

Also this question has the same answer regardless of whether dealing with computers or not. The idea of countability was around long before computers even existed.

[b]
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 7th Mar 2012 20:53
Quote: "You need an infinite number of bits to be able to represent any irrational number."

Its also worth pointing out that the algebraic numbers are countable, so you can still store any algebraic number in a finite number of bits. "Transcendental" would be more accurate than "irrational". Its the random transcendentals that are near impossible to store! (because a random real is transcendental with probability 1)

zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 8th Mar 2012 04:52 Edited at: 8th Mar 2012 05:10
For some Binary Pi Humor.....(Interesting because at least in a theoretical sense, it could be argued... true.)

Converting Pi to binary: DON'T DO IT

<source>http://www.netfunny.com/rhf/jokes/01/Jun/pi.html

~~~~~~~~~~~~~~~

In keeping with interesting binary representation of Pi

Quote: "I'd say yes. Binary is just a format. A byte can mean as many things as you want it to.
Binary can theoretically represent anything you want it to, but whether or not you want to perform calculations on your "number" would determine if binary could represent complex/irrational numbers.

So I'd go with c) It depends on whether the number needs to be computable.
But I would be interested to hear why the correct answer is a)."


I believe this coincides with what Big Add has stated above. I found the following images/representations to be interesting.


A plot of the first 1600 decimal digits of (mod 2) is shown above (left figure), with the corresponding plot for 22/7 shown at right. Here, white indicates an even digit and black an odd digit (Pickover 2002, p. 285).



And then there's..

http://www.befria.nu/elias/pi/binpi.html

.oO()Oo.oO (I'm not a real programmer,, I just play one on the Forums!!!) Oo.oO()Oo.
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 8th Mar 2012 06:07
How would i go about calculating pi? Like what formula would i use to calculate pi so that it goes on infinitely? I have heard of the 22/7 one would use whilst calculating stuff but that only gives a lame, terminating 3.14.

Copyrightz © 2012 dbd79
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 8th Mar 2012 06:39 Edited at: 8th Mar 2012 07:08
Currently Plouffe, Bellard, & Chudnovsky formulas ~ variations on Machin-like formulas or the Gauss-Legendre algorithm (simultaneously and independently & aka Brent-Salamin algorithm). Among many other notables (too many contributions to list)


Current record 10 Trillion+? (at least as of 2011).
Made use of....
~~~~~~

Plouffe's Formula


Bellard's Formulas


Chudnovsky


~~~~~~

Summation/Calculus
http://en.wikibooks.org/wiki/Calculus/Summation_notation


~~~~~~

General Historical Calculations of Pi
http://en.wikipedia.org/wiki/Pi

~~~~~~

As of October 2011 10 trillion digits (sure it's more now)
it was 5 trillion using y-cruncher
http://www.numberworld.org/misc_runs/pi-5t/details.html
then 10 trillion the highest y-cruncher can calculate
http://www.numberworld.org/misc_runs/pi-10t/details.html

y-cruncher
http://www.numberworld.org/y-cruncher/

~~~~~

Gauss-Legendre ( 206,158,430,000 decimal digits of π 1999)
http://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm

Machin Formula (100 decimal places π 1706)
http://en.wikipedia.org/wiki/Machin_formula

Machin-like variations
http://en.wikipedia.org/wiki/Machin-like_formulas

.oO()Oo.oO (I'm not a real programmer,, I just play one on the Forums!!!) Oo.oO()Oo.
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 8th Mar 2012 07:33
Ah interesting! Thanks!

Copyrightz © 2012 dbd79
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 8th Mar 2012 08:32
Quote: "Quote: "It depends how you define "number". You can never represent the number 0.1 using a binary system...."

With a fixed point and a couple bytes you could. "

So there's a point where computers or compilers would round up the value?

Quote: "To be fair, computers aren't mentioned in the question, so you were wrong."

I'm glad you're speaking in past tense Obese .

Quote: "So I'd go with c) It depends on whether the number needs to be computable."

That's where I went wrong. I assumed that the question was in the context of 'computational' but that's a good answer as well. Next time I see my lecturer I'll ask him for his reasoning as to why a) was correct.

Quote: "You can represent any integer in a finite number of bits.
You can represent any rational number in a finite number of bits."

That makes sense.

Quote: "You need an infinite number of bits to be able to represent any irrational number."

So then it's technically impossible to represent an irrational number perfectly since it would just go on forever.

@All, thanks for the replies. It has certainly been an informative read; it's always worth running these sorts of things past you guys.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Mar 2012 13:40
@Hodgey

Quote: "This will output 123.449997. I'm curious as to how that little bit of accuracy is lost."


I think AppGameKit is correct (unless that's what you meant - I'm not sure from your post ) - the question should be: why does the DBPro print command give the impression that accuracy ISN'T lost?

Try this:

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 9th Mar 2012 06:01
Quote: "
I think AppGameKit is correct (unless that's what you meant - I'm not sure from your post )"

Those are just examples, the correct mathematical result is 123.45 as we all know. I was just curious as to why is wasn't printed as such in AGK. From your example it looks like DBP suffers from it as well.

Quote: "the question should be: why does the DBPro print command give the impression that accuracy ISN'T lost?
"

That's another good question, maybe DBP has a decimal rounding algorithm.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Mar 2012 13:25
Quote: "From your example it looks like DBP suffers from it as well."


You still seem to have missed the point. The DBPro text command and, it seems AppGameKit, are probably printing the correct value as stored in the computer (apart possibly from minor rounding in the last few digits because of the mismatch between decimal and binary).

The apparent inaccuracy arises because only certain decimal fractions can be expessed precisely in any given finite binary representation. In this case, your value of 123.45 might need more bits than are used in 32 bit DBPro floats. You can see what happens if you use your favourite calculator to express 123.45 as a simple sum of powers of 2 - you'll need a wide range of powers. It starts with 64 (2 to the power 6) and I got bored after reaching 2 to the power -15 (giving a total of about 123.4499817).

Quote: "That's another good question, maybe DBP has a decimal rounding algorithm."


That's the real question here - and what is that algorithm? How can we predict what values will be printed? At least the mismatch between binary and decimal fractions is well understood - or should be.
old_School
15
Years of Service
User Offline
Joined: 29th Aug 2009
Location:
Posted: 9th Mar 2012 21:30 Edited at: 9th Mar 2012 21:36
The correct answer is no, that is why binary is limited to 256. This is why we created “the programming language” to bypass the limitations of binary. Once binary programming language was created, we created other languages to make programming a more understandable process. Of course later on, we created and add new programming languages to give us more power and ability to create better software.
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 9th Mar 2012 22:02
Quote: " that is why binary is limited to 256"

100000001=257

Dar13
17
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 9th Mar 2012 22:49
Quote: "binary is limited to 256"

Neuro already beat me to it, but binary is a number system(base-2) not a variable type like char or byte so there is no 'limit' that binary cannot pass.

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 9th Mar 2012 23:05 Edited at: 9th Mar 2012 23:06
Quote: "100000001=257"

Also, 100000010=258

Haha but yah, there are no limitations at all on binary.

Copyrightz © 2012 dbd79
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 9th Mar 2012 23:16
Quote: "You still seem to have missed the point. The DBPro text command and, it seems AppGameKit, are probably printing the correct value as stored in the computer (apart possibly from minor rounding in the last few digits because of the mismatch between decimal and binary)."

I see now, thanks GG.

Quote: "In this case, your value of 123.45 might need more bits than are used in 32 bit DBPro floats. "

And hence we get that tiny bit of accuracy loss.

Quote: " I got bored after reaching 2 to the power -15"

I don't blame you.

Quote: "The correct answer is no, that is why binary is limited to 256."

Isn't the 8 bit binary number (unsigned) limited to 255?

Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 10th Mar 2012 00:39
Quote: "Isn't the 8 bit binary number (unsigned) limited to 255?"

256 values, including 0. But 255 is the highest number, yes

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Mar 2012 01:31
Quote: "And hence we get that tiny bit of accuracy loss."


I believe so.

The other thing to remember with floats is that they are split into something called the mantissa and the exponent. My understanding (which could be a bit off ) is that roughly speaking the first tells you the first few significant bits and the second tells you how big it is as in the decimal equivalent 1.2345 e+002 (= 123.45 or 1.2345 x 100) - except that in binary you multiply by powers of 2 rather than 10.

Something like 22 or 23 of the 32 bits in a DBPro float are reserved for the mantissa (the binary equivalent of 1.2345) and the rest for the exponent (the binary equivalent of 100). One of those 32 bits is reserved for the sign (I'm not sure which) and I suspect one or two others may be reserved for things like NAN. IanM will be able to give you a more precise breakdown of the full 32 bits if you ever need it.

In terms of more familiar decimals the 22 or 23 bits for the mantissa mean that you get about 6 or 7 accurate decimal significant figures (2^23 = 8388608).
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 10th Mar 2012 04:30 Edited at: 10th Mar 2012 04:32
Here is a couple of Ian M's responses on floats/decimals/accuracy,, pulled from an old thread.

1.
Quote: "
Floats are not infinitely precise - with only 4 bytes of storage, there's no way that they can be.

The way that floats are implemented gives them, on average, 7 significant digits of precision - that means that the first 7 digits of any number you store in a float will be accurate, and any digits after that may not be.

For example: your value of 70377.754 has 8 digits specified, but only 7 will be accurately stored, and in fact results in a value of 70377.758 being displayed when printed with 3 decimal places.
"



[/quote]

2.
Quote: "
Yes, you can use a double float, which has 15 digits of precision, but there are quire a few limitations - they don't support anywhere near the same number of operations as floats, and when you attempt to carry out those operations (eg SIN() ), then DBPro will convert to float first, carry out the operation, and convert back later, making them slower than floats, and only as accurate as floats.

I may do something about that someday via my plug-in set.
"


"Whose idea was it to store floats in four bytes anyway?"

3.
Quote: "
A physicist who needed speed and accuracy (True: Look it up if you are interested.)
"


.oO()Oo.oO (I'm not a real programmer,, I just play one on the Forums!!!) Oo.oO()Oo.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 10th Mar 2012 11:39
Quote: "The other thing to remember with floats is that they are split into something called the mantissa and the exponent. My understanding (which could be a bit off ) is that roughly speaking the first tells you the first few significant bits and the second tells you how big it is as in the decimal equivalent 1.2345 e+002 (= 123.45 or 1.2345 x 100) - except that in binary you multiply by powers of 2 rather than 10."

That's very interesting, I didn't know that. I'll have to brush up on expoential maths.

Quote: "IanM will be able to give you a more precise breakdown of the full 32 bits if you ever need it."

IanM seems to know everything about DBP . It's unlikely I'll need to know but it's good to know that someone has the answer.

Quote: "Here is a couple of Ian M's responses on floats/decimals/accuracy,, pulled from an old thread."

Those are a good read, thanks for sharing zenassem.

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Mar 2012 01:41 Edited at: 11th Mar 2012 01:45
Quote: "Its also worth pointing out that the algebraic numbers are countable, so you can still store any algebraic number in a finite number of bits. "Transcendental" would be more accurate than "irrational". Its the random transcendentals that are near impossible to store! (because a random real is transcendental with probability 1)"


You're right, although you can store all of the transcendental numbers we know about in a finite number of bits too (We know about a finite (and therefore countable) number of transcendental numbers).

Also, interesting (or not) fact about floating point numbers: in the standard floating point formats (ie. single precision, double precision) the highest bit of the mantissa is not actually stored, it is just assumed to be 1. (If it was zero, you would just shift it left one place and decrease the exponent by one until it is not zero). The only number where this doesn't work is zero, since it is the only number where all the bits are zero, so floating point numbers can't actually store zero in the normal way!

The exponent is not stored using two's complement as you might expect, and is instead stored so that a value of zero in the exponent field is actually an exponent of -127, and a value of 255 equates to +128.

Finally, when the exponent is at its smallest or largest (-127 or 128) the number is "special". These special values allow storing zero, negative zero, infinity, negative infinity, not a number, and a whole load of "denormalised" numbers which are not zero but can't be shifted far enough to be normalised (have a most significant bit of one) without overflowing the exponent.

Together, all these special cases mean that a floating point value of zero coincides with all the bits being set to zero, which means the system can initialise a block of memory to all zero bits and know it will equal the numerical value of zero regardless of how the memory is used (ie. as a floating point number, an integer, etc).

[b]
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 12th Mar 2012 09:59
Quote: "The correct answer is no, that is why binary is limited to 256."


Source, please


Senior Developer - CBS Interactive Music Group
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 12th Mar 2012 23:25
Quote: "Source, please"

This.

Copyrightz © 2012 dbd79
Happy Strawberrycake
User Banned
Posted: 12th Mar 2012 23:32
Hello guys. As many of you can see I'm new to the forums... Bear with me.

Well as far as i know any number can be represented in binary. Integers, negative numbers, even decimals with floating point stuff.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Mar 2012 16:18
If you stick to integers, then every number can be represented. Once you delve outside of that realm then the answer becomes no, as it does with every other possible base.

For instance, you can't convert the decimal fraction 1/10 to an exact binary number, in the same way you can't convert the fraction 1/3 to exact decimal.

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th Mar 2012 00:25
But you can represent every possible rational number if you don't try to represent it directly as a decimal. I suppose that's more of a smartarse answer but it's still true!

Here's the first 1024 rational numbers:


So the first rational is 1/1, the second is 1/2, the third is 2/2, etc.
In this way you can count off every single rational number, eg for any rational number you can assign to it an integer. The method I'm using has the problem that the integer isn't unique (because 1/1=2/2), but this can be fixed by removing duplicates.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2012 01:19
That still leaves all of the irrational numbers, for example: e, pi and sqrt(2)

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Mar 2012 03:09
No it doesn't:
If you encode the coefficients of an arbritrarily large polynomial as a single number, you have effectively stored the roots of that equation, which includes all the algebraic numbers. To take it to the extreme, if you encode the textual representation of a number (ie. "pi") you can store all possible numbers we can ever construct.

[b]
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th Mar 2012 07:00 Edited at: 16th Mar 2012 07:02
Huh? We can encode all the digits of pi. It's:



but yeah, what diggsey said. That still leaves the random reals though. THOSE we can't construct.

zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 16th Mar 2012 07:17
3.14 in the mirror is PI.E

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 16th Mar 2012 07:25
Quote: "Hello guys. As many of you can see I'm new to the forums"

Welcome to the forums Happy Strawberrycake. So we have a Happy Cheesecake and a Happy Strawberrycake, any other Happy cakes I should know about?

Quote: "If you encode the coefficients of an arbritrarily large polynomial as a single number, you have effectively stored the roots of that equation, which includes all the algebraic numbers. "

How do you encode the coefficients of an arbritrarily large polynomial into a single number?

This is becoming very mathematical.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2012 15:34
Quote: "We can encode all the digits of pi"

Sure - go ahead and do that. I'll wait...

That's my point though.

As soon as you get a number that has an infinite expansion, you can't represent it as a number unless you truncate it at some point. At that point though, it's a different number.

Yes you can represent it as some sort of expression, but that isn't a number.

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Mar 2012 15:36 Edited at: 16th Mar 2012 15:39
Quote: "How do you encode the coefficients of an arbritrarily large polynomial into a single number?"


http://en.wikipedia.org/wiki/Countable_set#Formal_definition_and_properties

Quote: "By a similar development, the set of algebraic numbers is countable, and so is the set of definable numbers.

Theorem: (Assuming the axiom of countable choice) The union of countably many countable sets is countable."


Quote: "Yes you can represent it as some sort of expression, but that isn't a number."


I don't see why not: when we represent a number in two's complement, that is also an expression. You're saying sum the powers of two according to whether a given bit is 1.

[b]
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Mar 2012 15:38
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Mar 2012 15:40
Quote: "That assumes the countable set of numbers, but Irrational numbers are uncountable."


No it doesn't, the coefficients of the equations describing algebraic numbers are all integers and therefore countable.

[b]
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th Mar 2012 18:55
Quote: "As soon as you get a number that has an infinite expansion, you can't represent it as a number unless you truncate it at some point."

nuuu it was a joke, the punchline being that pi ends with 999999 and continues with an infinite series of 9s.

Quote: "How do you encode the coefficients of an arbritrarily large polynomial into a single number? "

It's easier to come up with a math argment than to come up with a specific function. There are two things to know: Z (the set of integers) is countable. That means we can choose a natural number for every integer. The function would look something like:
F:N->Z={(1,0),(2,1),(3,-1),(4,2),(5,-2),(6,3) ... }
so that f(3)=-1, and in this way we can cover the whole set of the integers.

This means that, in a sense, the natural numbers have the same amount of stuff in them as do the integers. In other words: The natural numbers are equinumerous with the integers. In other words: N~Z. (A~B means A is equinumerous with B).

There's another weird part to this notation. The cartesian product of two sets is denoted AxB. If A={1,2,3} and B={b,c}, then AxB is the set of all ordered pairs (x,y) where x is an element of A and y is an element of B. So AxB={(1,b),(2,b),(3,b),(1,c),(2,c),(3,c)}.

What we can prove is that Z~ZxZ. Since the ~ operator works a bit like the equal operator, this means N~ZxZ. The reason for this becomes clear when you consider the function from N to ZxZ:

F:N->ZxZ={(1,(0,0)),(2,(1,0)),(3,(1,1)),(4,(0,1)),(5,(-1,1)),(6,(-1,0)),(7,(-1,-1)),(8,(0,-1)),(9,(1,-1)),(10,(2,-1)) etc} (a counterclockwise spiral around the origin)

This can be extended to a theorem saying that for any set A, A~AxA. That means that ZxZ~ZxZxZxZ, and since ZxZ~Z, ZxZ~ZxZxZ.

SO...
Any polynomial with degree less than some positive integer n can be represented as ZxZxZxZ...Z, with n cartesian products of Z, and since this must be equinumerous with N, it's countable.

An alternative to this mathy talk is to just provide a function that counts off polynomials but I can't think of one atm. (sometimes proving they exist is easier than creating them.)


There's also the set of all computable numbers, which - importantly - IS COUNTABLE! This is any number that we can work out the digits for any finite n number of digits. This means Pi, e, everything like that can be stored in a finite number of digits (in a natural number), because it can be stored as an algorithm which computes pi. From this algorithm you can get any umber of digits desired, but the storage itself cannot be considered truncated because you can get any number of digits.


We still have the random reals to worry about, those are the numbers where every digit is a random digit from 0 to 9. It turns out that these numbers CAN generate numbers like Pi, E, and other computable numbers, but they do so with probability 0. (disclaimer: I haven't gone through the math yet, I've just read about it)

zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 16th Mar 2012 23:34
Quote: "nuuu it was a joke, the punchline being that pi ends with 999999 and continues with an infinite series of 9s.
"

Can you clear up what you mean by this? Pi doesn't ever come down to infinitely repeating a single digit. There are some long runs... I'll have to look up the exact locations of the more interesting runs,, including counting runs like (0,1,2,3,4,5,6,7,8,9), fibonacci sequences 0,1,1,2,3,5,8,13,21,34...., and other interesting pattern sequences. Though none of them, not even sequences repeat forever. Was the 999999... meant as a truncation of a sort.

I'm quite sure I am missing the joke.

.oO()Oo.oO (I'm not a real programmer,, I just play one on the Forums!!!) Oo.oO()Oo.
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 17th Mar 2012 00:29
The 999999 is in Pi, so by reciting it and then saying "and so on" it makes it sound like the only digits after it are 999999999 etc

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 17th Mar 2012 00:50 Edited at: 17th Mar 2012 00:54
Been watching this with interest when I thought about the days when I used to use fixed point precision. At first I though yes, every number could be represented by binary until I thought of the recurring number after a decimal point. So, err, no I guess, unless you can represent the recurring number... (Could binary represent 2 / 3 ?)

EDIT: Whoops, didn't flick through to page 2...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Mar 2012 02:17
Quote: "The 999999 is in Pi, so by reciting it and then saying "and so on" it makes it sound like the only digits after it are 999999999 etc"


If pi did have a recurring decimal at some point then it would be a rational number. It isn't.

Login to post a reply

Server time is: 2025-05-22 07:12:09
Your offset time is: 2025-05-22 07:12:09