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

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, and then we'll calculate the size of the visible universe in centimeters.

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. What the Indians had discovered, in fact, was the order in which the digits have to be multiplied in order to generate the result starting with the leading digit.

Computers

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.

For example, an 8-bit computer can store a number up to 255 and still recognise it as a number. It can, however, store strings up to 256 characters in length (because zero is a number too). If those characters are all digits, it might not be able to perform arithmetic on it, but it can store a number this size.

Importantly, you can extract individual digits from a string and perform operations on it - it's a single digit, so you can treat it as a number. 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.

Testing

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. So let's do this now. I originally did this in inches, but centimeters actually make more sense because a meter is defined by the speed of light.

First off, let's figure out how many seconds there are in a light year: 60 (seconds) x 60 (minutes) x 24 (hours) = 86,400 (seconds in a day) 86,400 x 365.25 = number of seconds in a year.

The speed of light is 299,792,458 meters per second, multiply that by 100 to turn it into centimeters, and then multiply the result with the number of seconds in a year to give us the distance light travels (in cm) in a year. 31,557,600 x 29,979,245,800

The visible universe is 13.8 billion light years in radius. We can't see further than this, because this is also the age of the universe. Any light from further away simply hasn't had enough time to reach us. However, those galaxies we can see 13.8bly away have, in the time it has taken their light to reach us, continued to move away from us. Where are they now? 46.5 billion light years away. This is known as the comoving distance. Double this radius to get the diameter, and we get 93 billion light years.

We know how big a light year is (in cm), so we simply have to multiply by 93 billion (or if we're lazy, multiply by 93 and then add nine zeroes). We don't have to get lazy, we have a computer algorithm that can do this for us. The result?

87,984,793,395,001,440,000,000,000,000 cm.

That result is 29 digits long, and is several orders of magnitude larger than a 64-bit computer can actually understand is a number.

You can download the PHP code, including a test script that calculates the size of the visible universe on the downloadsplugin-autotooltip__default plugin-autotooltip_bigDownloads

Orbital Calculator Current Version This is a portable application, meaning there is no installer. Just unzip into a folder and run the executable. Since it is portable, it can be run from a USB stick.

A full description and a list of the features are available
page.

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:
V G G J O
 
blog/articles/science/how_big_is_the_universe.txt · Last modified: 2019/03/06 10:37 by Phil Ide

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
  • ISSplugin-autotooltip__default plugin-autotooltip_bigInternational Space Station

    This page has a portal through which you can view the current location of the International Space Station, updating in real-time. The tracker itself comes from the European Space Agency (ESA).

    There is also a handy link to get email notifications direct from NASA when the ISS is visible in your night sky.
  • Mars Weatherplugin-autotooltip__default plugin-autotooltip_bigMars Weather

    Weather Reports Insight Lander Perseverance Rover Curiosity data to come [Current positions of Earth and Mars] Image courtesy of and © Dominic Ford

    This image is updated once per week. A daily update is available on the Mars Solar Conjunctions page when such events are active.

    You can check the position of Mars vs the Sun and Earth for any date here:
  • Downloadsplugin-autotooltip__default plugin-autotooltip_bigDownloads

    Orbital Calculator Current Version This is a portable application, meaning there is no installer. Just unzip into a folder and run the executable. Since it is portable, it can be run from a USB stick.

    A full description and a list of the features are available
  • Orbital Calculatorplugin-autotooltip__default plugin-autotooltip_bigOrbital Calculator

    I needed to calculate orbital characteristics for any orbit around any gravitational mass (because I write sci-fi stories), so I wrote this program because I'm a programmer and I'm too lazy to do it by hand all the time. The program has expanded over the last few years, sometimes from suggestions by other writers. I make it freely available and as simple to use as possible. It now has a list of functions as long as your arm (assuming you're not a tentacle user), and the numbe…
  • Cookie Policy & GDPRplugin-autotooltip__default plugin-autotooltip_bigCookie Policy & GDPR

    There are NO tracking cookies on this site!

    The Cookie policy is straightforward. This site only uses cookies that are required to make your experience of using this site better, and only uses session cookies (see exceptions below). Session cookies are deleted when you close your browser.
  • Book Reviewsplugin-autotooltip__default plugin-autotooltip_bigBook Reviews

    Here you can find all the book reviews, broken down by genre, and further subdivided by author. If you want me to review your novel, please read my Rules on Reviewing.

    * Science-Fiction * Fantasy * Non-Fiction
  • Contactplugin-autotooltip__default plugin-autotooltip_bigContact

    If you have a burning desire to contact me, use the discussion form below. Anything you say remains private between you and me.