10761
Question of the Week / Re: QotW - 11.09.11 - How does a calculator work?
« on: 16/06/2012 06:12:30 »
The definition of an algorithm is one which always halts after a finite number of steps.
Taylor series and Newton's method rarely converge to the "correct" answer, and then stop (except for e^0=1, or if you guess the exact answer to start Newton's method).
With series which converge quickly, you can stop when each successive term adds a number smaller than the smallest digit displayed on the calculator.
More troublesome are those series which converge very slowly - series which generate pi are notorious for this; even after a lot of calculations, the answer is very inaccurate. With each calculation, rounding errors increase.
For series like this, it is common to rearrange the equation so it converges with very few calculations, but perhaps over a reduced range of values.
Suitable mathematical relations for the sine function (angles in radians):
sin(x)=sin(x+2*pi)
cos(x)=sin(x+pi/2)
Reducing the value of x closer to zero with methods like these means that you need fewer calculations to obtain the same accuracy.
Taylor series and Newton's method rarely converge to the "correct" answer, and then stop (except for e^0=1, or if you guess the exact answer to start Newton's method).
With series which converge quickly, you can stop when each successive term adds a number smaller than the smallest digit displayed on the calculator.
More troublesome are those series which converge very slowly - series which generate pi are notorious for this; even after a lot of calculations, the answer is very inaccurate. With each calculation, rounding errors increase.
For series like this, it is common to rearrange the equation so it converges with very few calculations, but perhaps over a reduced range of values.
Suitable mathematical relations for the sine function (angles in radians):
sin(x)=sin(x+2*pi)
cos(x)=sin(x+pi/2)
Reducing the value of x closer to zero with methods like these means that you need fewer calculations to obtain the same accuracy.