Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interesting Challenge
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00259328
Message ID:
00259431
Views:
18
>>Numerical Analysis, with something like a Taylor Series. I have to depart now, but I'll reply back later...
>
>Should have guessed you would be the first to reply... I am eagerly awaiting your post.

Taylor's a little complex and messy, I was reminded after examining the formula :) But Newton's method is simple, recursive, and fast to get high accuracy. We don't have subscripts, so I'll use [n] or [n+1] to mean the nth value in the recursion, and R is the number you want the root of. Then, let x[0] = 1 to get started, and use

X[n+1] = (x[n] + R/x[n])/2

So if R = 2 (you want SQRT(2))

x[1] = (1 + 2/1)/2 = 1.5
x[2] = (1.5 + 2/1.5)/2 = 1.416666

etc. Only 4 or 5 steps will give very high accuracy, check it out...
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Reply
Map
View

Click here to load this message in the networking platform