Efficient Calculation Techniques for Common Mathematical Functions

  • Thread starter Thread starter ice109
  • Start date Start date
  • Tags Tags
    Algorithms
ice109
Messages
1,707
Reaction score
6
what are some for evaluating logs? square roots? trig functions? this makes me curious

wiki said:
Gauss was a prodigious mental calculator. Reputedly, when asked how he had been able to predict the trajectory of Ceres with such accuracy he replied, "I used logarithms." The questioner then wanted to know how he had been able to look up so many numbers from the tables so quickly. "Look them up?" Gauss responded. "Who needs to look them up? I just calculate them in my head!"

obviously i don't intend to be gauss but it made me realize these things are never taught and just taken for granted. and obviously I am not talking about
log_{10}(100) maybe something like to a rational number.

actually now that I am thinking about it you could just solve the series expansion for the first couple of terms for the exponential but there's got to be a better way.
 
Mathematics news on Phys.org
That is an interesting topic, I am too, interested in such algorithms, as using calculator for some simple or not so simple calculations is a distraction for what can be a fluent flow of thoughts.

Anyway, a little contribution from me: my father showed me this little trick and I have not to this day even tried to see why it works, but frequently use it. It is a quick multiplication rule for squaring numbers which have last digit 5. The rule is as follows:
Multiply the "first" part (the non-five part) of the number with the following integer and then simply put 25 at the end. i.e. 15 x 15 = 1x2|25 = 225; 25 x 25 =2x3|25 = 625; 35 x 35 = 3x4|25 = 1225; 125 x 125 = 12x13|25 = 15625 and so on, you get the idea.

As I said, I've used this method frequently in my school years, but I had never thought why this works the way it does to this very day. So, feel free to use it from now on and if anyone has any hints on why it works that way it will be appreciated.

Also any hints for algorithms to other easy or not so easy calculations will be appreciated.
 
Last edited:
It works like this. Think of the number as k5 where k represents the digits in front of the 5.
Then, we can write the value of the number as 10k + 5.

Squaring the number gives us: (10k + 5)^{2} = 100k^{2} + 100k + 25.

But, this can be factored: 100k(k + 1) + 25.

And there it is.
 
You're looking for the Numerical Recipes books. They're available in their entirety here:

Numerical Recipes Online

You might be most interested in the Newton-Raphson method, which is the numerical approximation algorithm used by most pocket calculators.

- Warren
 
BSMSMSTMSPHD said:
It works like this. Think of the number as k5 where k represents the digits in front of the 5.
Then, we can write the value of the number as 10k + 5.

Squaring the number gives us: (10k + 5)^{2} = 100k^{2} + 100k + 25.

But, this can be factored: 100k(k + 1) + 25.

And there it is.

simple and beautiful. thank you.
 
BSMSMSTMSPHD said:
It works like this. Think of the number as k5 where k represents the digits in front of the 5.
Then, we can write the value of the number as 10k + 5.

Squaring the number gives us: (10k + 5)^{2} = 100k^{2} + 100k + 25.

But, this can be factored: 100k(k + 1) + 25.

And there it is.

Nice! very cool
 
sometimes a good taylor series is all you need though. most trig functions i quickly use a 3 term expansions, but if its close to some exact value eg sin 61 degrees, then i use the expansion to sin (x+y) and use the small angle properties. its actually accurate. for logs i define them as the area under 1/x blah blah, and for that i use simpsons rule a few times. square rooting, usually Newton-rhapson method. for large factorials there's stirlings approximation.
 
Back
Top