Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
So, we need to solve this problem.
x b = a, a > 0, or x b - a = 0
Newton's method says:
x n+1 = x n − f(x) / f′(x)
x n+1 = x n − (x n b — a) / (b x n b−1 ) = (x
n − a/(x n b−1 ) )/ b Ideal hacks with fractional numbers (for example, get the order and take the initial guess 2 [ord/b] for negative order and 2 [ord/b] + 1
for non-negative.
[x] - truncation of a fractional number, with an integer b [ord/b] = ord div b. You can use Delphi's Frexp and Ldexp functions to get the order, play around with it, and assemble it back into a machine fractional, they are very fast.
End when |x n+1 − x n | less e. Since the convergence of the method is quadratic, we are almost guaranteed to get the accuracy we need.
Since we need two approximations, n and n + 1, to check the accuracy, we store them.
And the last. Believe me, beautiful lady, no one will solve your educational problem to the end.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question