


Return to forum top
Re: How does math functions work?
Posted by goetterfunken [send private reply] at July 08, 2003, 04:31:38 PM
Regarding sqrt, try the HeronAlgorithm to determine sqrt(a):
([] are to be read as indices)
s[0] = a
t[0] = 1
s[n] = (s[n1]+t[n1])/2
t[n] = a/s[n]
while n grows s[n] and t[n] approach at each other and sqrt[a].
Imagine a rectangle with side lengths of a and 1. We create iteratively new rectangles with area a but new side lenghts: One is the average of the side lengths of the previous rectangle, the other is clear, when the area remains a.
This rectangle gets closer and closer to be a square and so it's side lenghts to sqrt(a).
The algorithm is quite fast: About six to nine iterations for pocket calculator accuracy  and all you need is basic operations.
Regards,
Werner
Posted by goetterfunken [send private reply] at July 08, 2003, 04:33:13 PM
Whoops... that one went wrong... sorry about that... can anybody put the previous message in the right thread?
Sorry!
You must be logged in to post messages and see which you have already read.
Register as a new user
