|
-
Dec 15th, 2015, 11:58 PM
#1
Thread Starter
Addicted Member
Extremely Large Numbers in VB
Hello...
Double.Maxvalue (about) 1.8 x 10^308
This may sound crazy, but this is not large enough for what I need, is it possible to raise something to become 1,000 digits or more? I'm trying to show how many total combinations of colors per pixel in an average computer screen. Obviously, this number is extremely large and may take a long time to compute. I've heard of Imports System.Numerics.BigInteger but I cannot import that for some reason. (I am running on Visual Community 2015.)
Anyway, if this is possible, I'd like to find out, but anyway, thanks to all in advance!
Nic
-
Dec 16th, 2015, 12:35 AM
#2
Re: Extremely Large Numbers in VB
BigInteger.
p.s. I didn't read to the end of the post and see you already tried that. hmmm...
I don't understand the number of colors per pixel statement.
If you're not including the alpha, the colors per pixel should be a maximum of 16M colors, 256 levels each of combinations of red, green and blue, i.e 2^24 combinations.
If you're talking about all the possible color combinations of the whole screen, then that is pretty ridiculous. It wouldn't be 1000's of digits, but millions of digits. If you consider an average computer screen these days to be 1920x1080, then the number of possible color combinations would be the 2^(24*1920*1080), or 2^29766400, which I would guess to be 10 to 12 million digit range (in base 10).
By the way, according to some estimates the number of atoms in the observable universe would be a number with about 80 digits, so the number of combinations of colors that the screen could be set to far exceeds anything that I would want to bother calculating.
But there are groups that do that sort of thing for fun, but they use much faster libraries than BigInteger for their calculations.
Last edited by passel; Dec 16th, 2015 at 01:11 AM.
-
Dec 16th, 2015, 12:52 AM
#3
Re: Extremely Large Numbers in VB
You don't import a type like that. Do you know what an Imports statement is for? Primarily, you use an Imports statement to import a namespace and thus allow you to use members of that namespace without qualifying them.
BigInteger is a type and it's a member of the System.Numerics namespace. If you don't import the namespace then you need to qualify the type in code, i.e. use the full System.Numerics.BigInteger name or, because the System namespace is imported by default, the partial Numerics.BigInteger name. If you do import the System.Numerics namespace then you can use just BigInteger in code.
Also, the BigInteger type is declared in the System.Runtime.Numerics.dll assembly, so you need to make sure that that assembly is referenced in your project. You should add the reference on the References page of the project properties. That's where you should import the namespace too, unless you have a specific reason for doing it in a single file only.
For future reference, the MSDN topic for any type will tell you what namespace it's a member of and and what assembly it's declared in. You might find it beneficial to follow the Blog link in my signature and check out my post on Assemblies & Namespaces.
By the way, as the name suggests, the BigInteger type can only represent whole numbers. If you need large fractional numbers then you'll need to look elsewhere.
Last edited by jmcilhinney; Dec 16th, 2015 at 12:58 AM.
-
Dec 16th, 2015, 03:40 AM
#4
Re: Extremely Large Numbers in VB
The number of combinations of pixels with different colors on a screen is (regardless of alpha channels, since that is nothing a display have):
( ( 2 ^ 24 ) ^ ScreenResolutionX ) ^ ScreenResolutionY
Of course humans wouldn't be able to see the difference in most of these combinations, but it's such a HUGE number that it's ridiculous and you wont be able to fit that into a BigInteger. The number is larger than the number of atoms in the known universe, even for a low resolution display. Actually the number of digits in that number is larger than the number of atoms in the known universe, so you can't even be able to type it out even if you just wrote one digit on each atom in the universe. Even a googolplex is a tiny insignificant number in comparison.
The number of atoms in the known universe is estimated to be between 10^78 and 10^82.
So even if you set your display to have VGA settings (16 colors on a 640x480) pixel display, even the first line on top of your screen would result in 16^640 different combinations which still mean that you need quadrillion of universes that are just like ours to be able to write out the number of digits, if you write one digit per atom.
So in short, it can't be done.
Last edited by Joacim Andersson; Dec 16th, 2015 at 03:52 AM.
-
Dec 16th, 2015, 05:09 PM
#5
Thread Starter
Addicted Member
Re: Extremely Large Numbers in VB
I know that the number will be ridiculously large. What is the max value of BigInteger?
By the way- Thanks to jmcilhinney, I did know not to import Biginteger, that was a typo, but I did not know I had to refrence the System.Numerics. (It's not System.Runtime.Numerics, anyway.)
However I did find a way to create an enormous number without BigInteger. I believe this is slightly inaccurate though, the larger the numbers get. (Because when it divides by 10, eventually it will have to round the E(-308)th place.) It still works though, and I learn that even with just using 2 colors, your digits will run up to the hundred thousands and millions place.
vb Code:
Dim HugeNumber As Double = ColorAmount 'The amount of colors to use.
Dim Exp As Double = 0
Dim Area As Double = ImageSize.Width * ImageSize.Height
For i As Double = 1 To Area - 1 Step 1
HugeNumber *= ColorAmount
Do Until HugeNumber < 10
HugeNumber /= 10
Exp += 1
Loop
Next
Dim HugeNumber_Str As String = Math.Round(HugeNumber, 3).ToString & " x 10 ^ ( " & Exp & " )"
Last thing- This was inspired after I found this website: I highly recommend you guys check it out, its actually pretty interesting once you understand what it is.
https://libraryofbabel.info/
Attachment 133325
-
Dec 16th, 2015, 05:13 PM
#6
Thread Starter
Addicted Member
Re: Extremely Large Numbers in VB
 Originally Posted by passel
But there are groups that do that sort of thing for fun, but they use much faster libraries than BigInteger for their calculations.
What could be used in place of BigInteger that is faster?
-
Dec 16th, 2015, 05:24 PM
#7
Re: Extremely Large Numbers in VB
What is the max value of BigInteger?
You can usually ask the documentation these kinds of questions. If you do, you find:
The BigInteger type is an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds.
The easiest implementation of a BigInteger would use a String to represent the number internally, or an array of digits. That means the "biggest" number you can represent is limited by how much memory you have, and that varies from system to system and even over time. But it's very likely you could fit a number with several hundred million digits, which is so large it's hard to imagine applications for it.
I believe this is slightly inaccurate though, the larger the numbers get.
Yes, anything involving floating-point numbers like Doubles has that problem, especially when you start performing math on them. They're internally stored as an integer and an exponent. That means the integer part's pretty reliable, but everything beyond 5 or 6 decimal places is questionable.
What could be used in place of BigInteger that is faster?
I bet there's some libraries that do it, but passel will have to answer that. I'm curious if my guess as to how they might work is true: it might be possible to represent such numbers as arrays of bytes, as arithmetic on bytes is easy. That'd be faster than digit-based math on Strings, certainly.
Displaying "all images" has an interesting property.
A monitor is a finite grid of pixels, but so long as it's large enough we can display photo-realistic images. So if I take a picture, and display that picture on a monitor, we're really just picking one of the many configurations of pixels.
Now, if we imagine a program that /could/ generate all combinations, we have an interesting property of that collection: in that set is a photo-quality image of every second of history from every possible angle, including events that haven't happened to people that haven't been born. But time is infinite.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Dec 16th, 2015, 05:28 PM
#8
Thread Starter
Addicted Member
Re: Extremely Large Numbers in VB
 Originally Posted by Sitten Spynne
Now, if we imagine a program that /could/ generate all combinations, we have an interesting property of that collection: in that set is a photo-quality image of every second of history from every possible angle, including events that haven't happened to people that haven't been born. But time is infinite.
Maybe the image archives on https://libraryofbabel.info/ would interest you. It includes what I've been trying to do; every possible image is in it. You may upload an image, and it will search and find it in the gallery.
Edit: Even though time is infinite, there is a real number on the limit of pixel combinations on a screen. That means, if you did take a shot at every possible perspective from every possible instant in history including the future, you would see an infinite amount of each individual image displayed.
These kinds of things blow my mind.
Last edited by NinjaNic; Dec 16th, 2015 at 05:34 PM.
-
Dec 16th, 2015, 06:21 PM
#9
Re: Extremely Large Numbers in VB
 Originally Posted by NinjaNic
I had to refrence the System.Numerics. (It's not System.Runtime.Numerics, anyway.)
That's what I thought but when I checked the local doco it said System.Runtime.Numerics. I just looked again and it actually says both, so I think there must be a type there. I checked the online doco and it correctly says System.Numerics. That local doco contains various sections of hidden text that appear under certain circumstances so maybe System.Runtime.Numerics applies to something other than VB and C# code.
-
Dec 17th, 2015, 09:14 AM
#10
Re: Extremely Large Numbers in VB
They probably moved it around in Silverlight, Core CLR, .NET Core, Windows Phone, or any of the other "almost .NET BCL" implementations that are important but I can't keep track of.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Dec 17th, 2015, 10:39 AM
#11
Re: Extremely Large Numbers in VB
Every possible image is not in it, as that wouldn't be possible, but it's certainly an odd project.
My usual boring signature: Nothing
 
-
Dec 17th, 2015, 11:36 AM
#12
Re: Extremely Large Numbers in VB
Well, you could certainly fudge it.
An 800x600 24-bit image is fairly easy to generate on the fly, it's only 11.25 kilobytes of data. Now, the number of possible images is bewildering, I had the math wrong for a while and thought it was more possible than it was. But let's say we have a way to represent this arbitrarily large number. And let's say that number's represented in binary. When we do this, the numbers in the range 0-??? all represent precisely the bit pattern of a single image in the set.
So we could write a tool that, given you are patient enough to input this several-hundred-digit number, could produce the image from the universe of possible images in probably a couple seconds' worth of calculation. That's almost as good as "I've already generated them and you can browse them". The trick is categorization, because you probably want to start somewhere specific.
And in truth, a ton of images are just useless garbage. An AI trained with a huge dataset, say the Flickr or Facebook image databases, could make big leaps towards disqualifying billions of candidates as "not an image of anything significant". I think it's more feasible to write a tool that could, say, receive one image as the "basis" and another image as the "target" and finds an image that looks like some manipulation of "basis" where "target" is a part of it.
I can think of some very profitable and unethical implications. The future's going to be weird shortly.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Dec 17th, 2015, 12:37 PM
#13
Re: Extremely Large Numbers in VB
That's probably roughly what the site is doing: Given some type of addresses (a nearly arbitrary address) into what appears to be a large b-tree like structure, return the image found at the leaf node. The address is just a means of generating an index that is used to generate an image. Similarly, you could take an image and turn it into an address by reversing the algorithm.
What you can't do is store all the images, as there isn't enough memory in the universe.
My usual boring signature: Nothing
 
-
Dec 18th, 2015, 06:35 AM
#14
Re: Extremely Large Numbers in VB
 Originally Posted by Shaggy Hiker
What you can't do is store all the images, as there isn't enough memory in the universe.
If you have a process that, given a reference, returns an image (and crucially, returns the same image each time you give it the same reference), in what fundamental way has that image not been "stored"?
-
Dec 18th, 2015, 08:55 AM
#15
Re: Extremely Large Numbers in VB
That's kind of my point: a generator function is indistinguishable from slow retrieval queries.
Something similar comes up in discussions of music piracy often. Suppose you consider the byte pattern that represents the audio data of a song, and concatenate all of the bits to form one very large number. You create a .txt file with the digits of the number, and send that .txt file to a friend. That friend parses the number, and outputs its byte pattern to a .mp3 file. Have you committed piracy? If so, does that mean the copyright holder of a song also has copyright to several numbers that represent the audio data? Would that also mean they own copyright to arbitrary-length substrings of digits within that number, since they represent small portions of the data? How many numbers are copyright infringement, if written in full?
(It was mind-blowing when I was younger. Now I consider it what it is: anti-compression! The .txt file would be at LEAST 8x larger than the original file! But then, text compresses really well...)
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Dec 18th, 2015, 09:30 AM
#16
Re: Extremely Large Numbers in VB
Hmmm, utterly off-topic, but....
 Originally Posted by Sitten Spynne
Something similar comes up in discussions of music piracy often. Suppose you consider the byte pattern that represents the audio data of a song, and concatenate all of the bits to form one very large number. You create a .txt file with the digits of the number, and send that .txt file to a friend. That friend parses the number, and outputs its byte pattern to a .mp3 file. Have you committed piracy?
Legally, yes. The copyright covers the "work" - you haven't created a different "work", you've copied it in a different format.
 Originally Posted by Sitten Spynne
If so, does that mean the copyright holder of a song also has copyright to several numbers that represent the audio data?
No, not if you created the number via a different creative process rather than a mechanical transcoding of some "work" they own the copyright on.
 Originally Posted by Sitten Spynne
Would that also mean they own copyright to arbitrary-length substrings of digits within that number, since they represent small portions of the data?
If they have a copyright interest in the context of the larger number, I think again they would have a copyright interest in a substring. However whether you have infringed it is a separate question because now you're venturing into the realm of fair use by taking a portion of the work.
 Originally Posted by Sitten Spynne
How many numbers are copyright infringement, if written in full?
If you are just writing out numbers, then none. It would depend on the context.
Disclaimer: I am not a lawyer, let alone one who specialises in Intellectual Property Rights.
-
Dec 18th, 2015, 10:26 AM
#17
Re: Extremely Large Numbers in VB
I mostly figured that stuff out over the years. I think what matters, legally, is whether I think I am sending a "really cool number" or "a number that *nudge nudge* *wink wink* is certainly not an mp3 file". Sending the number is fine, converting an mp3 to some arbitrary goofy format and sending that with the full intent of the receiver decoding it, well, that's just 'more complicated infringement'.
Now it's more interesting to me to think how /everything/ can be pushed around as a really large number.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Dec 18th, 2015, 10:36 AM
#18
Re: Extremely Large Numbers in VB
I have a copyright on the bit value of 1. Anyone that uses that in any kind of software is infringing my copyright and must pay a license fee on every use.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|