originally posted by: Tucket
a reply to: onequestion
Really cool, but I found the egyptian method to be inefficient. I just tried to solve 89/538 using the Egyptian method and I found myself reverting
back to the N. American method of multiplication just to find out the powers of 538. In the video its easy cause hes using easy numbers. Also, if I
use the N. American way for this equation, im writing fewer numbers.
Very cool thread nevertheless, Ill give the chinese method a go.
I was taught the lattice method but never used it, I didn't watch the video here but I remember the concepts. I don't think it's that good because it
requires a lot of space to write the problem out. Needing 1 additional line per every factor of 10 is very space efficient and that translates into
reducing the paper used, and less time writing out the problem. Remember that the more time you have to spend simply laying the problem out, the more
time you have to spend on each problem. Time to solve is pretty relevant in regards to viable methods.
originally posted by: onequestion
First of all why the hell wasnt i taught this in school? No wonder so many of them are becoming programmers in India and China. Makes sense they are
teaching them how to do proper math. I want to learn how to do this.
This method works well on pencil and paper but only for smaller numbers, the larger you go the more space you have to use on the paper and the more
time you spend writing, every additional column increases the size. You go from a 2x2 square (4) to multiplying 10's in a 3x3 (9), 100's in a 4x4
(16), and 1000's in a 5x5 (25), scale down if you're using decimals. It gets exponentially larger for each digit.
Personally, I find it useful to be able to convert binary to decimal as well as hexadecimal to decimal but I work with computers day in and day out.
I don't actually think this Egyptian method is better for most applications and that's because the numbers we use every day are in base 10 while this
method being taught is in base 2. Whatever you gain in having a simpler solution (and it's only simpler if you have paper) you lose in having to do
the conversions. Most of us can't automatically equate 11 in binary as being 3 in base 10.
I'll teach you two more methods real fast. The first is what I use and what they're trying to teach in common core. The advantage to this method is
that you can quickly solve problems in your head. The disadvantage is that you can't approach the problem in a straightforward manner. In order to
multiply or divide you need to also add and subtract. Lets use an example of 73*529 (randomly picked those numbers, there's no significance to
them).
The basics of this idea are that you factor the numbers to numbers that round to 5 and 10, I only use 10 but it's being taught today to also use 5.
So 73*529 can also be expressed as (70*529)+(3*529). We can also round the 529 because 73*529 can be expressed as (73*530)-73. Using both of those
principals you can express 73*529 as ((70*530)-70)+((3*530)-3). If that's not simple enough you can take it a step further from this point and write
it as ((70*500)+(70*30)-70)+((3*500)+(3*30)-3). This problem might look more complicated but if you're trying to compute it in your head it is far
easier to solve. This equation evaluates to ((35000)+(2100)-70)+((1500)+(90)-3) which then evaluates to (with some reorganizing)
35000+2100+1500+90-70-3. That then becomes 37100+1500+20-3 which is then 38620-3 and finally 38617. It might seem unwieldy at first but once you get
used to it, it is actually very easy to evaluate expressions this way. I'm regarded by most math people I meet (math majors, computer scientists, and
people that hit calculator buttons really fast) as having exceptionally fast and accurate computational ability, this method is a large part of why
that is, I quite literally use it hourly if not more.
The next thing I want to show you goes back to binary, it's a technique known as bitshifting and is a way to multiply or divide by powers of 2
quickly. Computers actually do this to save CPU cycles in order to optimize. If you go back to the video you posted the presenter goes through some
basics of how binary is represented. We'll take a typical 8 bit (1 byte) unsigned value which ranges from 0-255. Lets use 173, that would be
expressed in binary as 10101101:
128 - 1
64 - 0
32 - 1
16 - 0
8 - 1
4 - 1
2 - 0
1 - 1
Now, if I want to divide that number by 2, excluding the remainder I can just move all of the bits 1 to the right, with the right most bit falling off
(multiplication moves it 1 to the left, and if you run out of space a value also falls off... which would be an insufficient memory error in the case
of a machine, but here we could just add a 256's column). That means 10101101 becomes 01010110. If you convert that back into decimal form.
128 - 0
64 - 1
32 - 0
16 - 1
8 - 0
4 - 1
2 - 1
1 - 0
And then add that up you get 64+16+4+2=86 which is 173/2 or 86.5 (becomes 86, there are no decimals in binary). Using this technique a computer can
multiply or divide by powers of 2 (2, 4, 8, 16, 32, 64, 128, 256, etc) very very quickly. If you wanted to divide by 4 instead you would shift 2 to
the right, or by 8 it would go 3 to the right. Using the 173 example again 10101101 becomes 00010101 which if you write out is 21
128 - 0
64 - 0
32 - 0
16 - 1
8 - 0
4 - 1
2 - 0
1 - 1
And if you calculate it out 173/8 is 21.625 which truncates to 21.
This type of bit operation is the fastest operation a computer can do actually. If you're interested further in this, there's a relatively famous
application of it in the collision check Quake 3 Arena which allowed the game to perform some very advanced lighting and reflection techniques.
Here's the wiki page.
Most compilers and interpreters will automatically bitshift if possible these days so you don't have to expressly tell a computer to do it, but I do a
good deal of math when trying to optimize my code that can take advantage of faster math like this (among other techniques).
edit on 8-12-2014
by Aazadan because: (no reason given)