Efficient Calculation Techniques for Common Mathematical Functions

  • Thread starter ice109
  • Start date
  • Tags
    Algorithms
In summary, evaluating logs, square roots, and trig functions can be done using various algorithms such as the Newton-Raphson method, Taylor series, and Simpson's rule. These methods allow for quick calculations and can be used for both simple and more complex numbers. Additionally, the use of factorials can be simplified using Stirling's approximation. These techniques are often taken for granted, but can be useful for mental calculations and avoiding the use of calculators.
  • #1
ice109
1,714
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
[tex]log_{10}(100)[/tex] 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
  • #2
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:
  • #3
It works like this. Think of the number as [tex]k5[/tex] where [tex]k[/tex] represents the digits in front of the 5.
Then, we can write the value of the number as [tex]10k + 5[/tex].

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

But, this can be factored: [tex]100k(k + 1) + 25[/tex].

And there it is.
 
  • #4
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
 
  • #5
BSMSMSTMSPHD said:
It works like this. Think of the number as [tex]k5[/tex] where [tex]k[/tex] represents the digits in front of the 5.
Then, we can write the value of the number as [tex]10k + 5[/tex].

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

But, this can be factored: [tex]100k(k + 1) + 25[/tex].

And there it is.

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

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

But, this can be factored: [tex]100k(k + 1) + 25[/tex].

And there it is.

Nice! very cool
 
  • #7
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.
 

Related to Efficient Calculation Techniques for Common Mathematical Functions

1. What are algorithms?

Algorithms are a set of step-by-step instructions or rules used to solve a specific problem or complete a task. They are used in many different fields, including computer science, mathematics, and engineering.

2. How are algorithms used in everyday life?

Algorithms are used in everyday life in various ways, such as in search engines, social media algorithms that determine what content is shown to users, navigation systems, and even in everyday tasks like making a cup of coffee using a coffee machine.

3. What are some common algorithms used in computer science?

Some common algorithms used in computer science include sorting algorithms like bubble sort and merge sort, searching algorithms like linear search and binary search, and graph algorithms like Dijkstra's algorithm.

4. How do algorithms improve efficiency?

Algorithms improve efficiency by providing a step-by-step process to solve a problem, which allows for a more systematic and organized approach. This can save time and resources, making tasks more efficient and accurate.

5. Can algorithms be wrong?

While algorithms are designed to be precise and accurate, they can still produce incorrect results if there are errors in the instructions or input data. It is important for algorithms to be thoroughly tested and evaluated to ensure their accuracy and effectiveness.

Similar threads

  • General Math
Replies
14
Views
603
Replies
9
Views
3K
Replies
3
Views
1K
  • General Discussion
Replies
8
Views
921
Replies
7
Views
2K
Replies
5
Views
1K
  • General Math
Replies
12
Views
1K
  • Programming and Computer Science
Replies
30
Views
4K
Replies
4
Views
801
Replies
30
Views
7K
Back
Top