Philip P. Ide

Author, programmer, science enthusiast, half-wit.
Life is sweet. Have you tasted it lately?

User Tools

Site Tools


blog:articles:science:how_big_is_the_universe

This is an old revision of the document!


How Big Is The Universe?

Hubble deep Field Image I recently came across a youtube video explaining a method for multiplication that was quite different from long multiplication. To explain why this was so interesting, let’s first talk about long multiplication and what’s wrong with it.

Although long multiplication is fairly easy to teach, it has drawbacks. Firstly, you need to generate one interim result for each of the digits in the multiplier, and then sum these interim results. This takes up a lot of space when the multiplier is quite large, and takes a bit of time. The final result derives the least significant digits first – that is, the rightmost digit.

The other method only ever produces two interim results, and it generates them at the same time. The final result is generated beginning with the most significant digit, and in fact you can begin reading off the result before you have finished the calculation. Pretty awesome huh?

So, where did this method come from? India. It was published in a book written 3,000 years ago. Impressive stuff. Even better, the method has a name (in Sanskrit), and encoded in the name are the instructions for employing the method. Know the name, know the method.

Let’s go back and consider long multiplication again. It works by multiplying each digit in one number by each digit in the other, and by ensuring that each pair of digits are only multiplied once. The Indian method does exactly the same thing, only in a different way, allowing the result to be generated from the most significant digit first.

Computers can only understand numbers up to a certain value. If a number won’t fit on the CPU’s registers, it can’t understand it. This creates limitations. However, computers can handle strings, sequences of characters that can be digits, of a much longer length. You can extract individual digits from a string and perform operations on it. I immediately saw that the Indian method for multiplying large numbers was suited to this kind of operation.

I set about writing an algorithm that would perform all the necessary operations in the correct order. I encoded the algorithm in a class, written in PHP. PHP is a very simple, high-level computer language. If it can be done in PHP, it can be done in almost any programming language. Placing the code in a class was a way of sanctifying the code so it wasn’t liable to be trumped by other code. If none of that makes sense to you, don’t worry about it. It works.

The first test I performed were on two four digit numbers. I could verify the results using a calculator or by using a pen and paper. Then I used longer numbers, to the point where the calculator was returning those dreaded ‘e’ numbers. I could still calculate by hand to verify the results. Then I went on to multiply two numbers, each of which consisted of 4096 digits. My code performed the calculation in moments. It took a lot longer to verify the results by hand. A lot longer.

Ok, so this is all working. I decided to calculate something stupid – stupid as in senseless, but also stupid as in stupidly big numbers. I decided to calculate the size of the visible universe. In inches.

There are 63,360 inches in a mile. The speed of light is 186,282 miles per second (it’s an approximation, but let’s use that figure anyway). There are 60 seconds in a minute, sixty minutes in an hour, twenty four hours in a day, and 365.25 days in a year. That makes 1 year = 31,557,600 seconds.

Multiply the number of seconds by 186,282 to get the number of miles in a light-year, then multiply again by 63,360 to get the number of inches in a light-year – 372,468,909,745,152,000.

The edge of the visible universe is 13.8 billion light-years away (again, an approximation, but we’ll run with it). If we look in the opposite direction, we see the same, so the visible universe is 27.6 billion light-years across. Multiply this by the number of inches in a light-year and we get our result.

The visible universe is 1,027,100,141,908,966,195,200,000,000,000 inches across.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Discussion

Enter your comment:
C V C V L
 
blog/articles/science/how_big_is_the_universe.1550280560.txt.gz · Last modified: 2019/02/19 12:15 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Copyright © Phil Ide
Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki