U
U
uliana002017-10-28 19:38:43
Delphi
uliana00, 2017-10-28 19:38:43

How to calculate the root of the nth degree?

Tell me how to calculate the n-th root with EPS accuracy using Newton's iterative formula and the number of iterations for which this accuracy is achieved.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mercury13, 2017-10-29
@Mercury13

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.

T
TCloud, 2017-10-28
@OTCloud

Here is a true calculator

U
uliana00, 2017-11-23
@uliana00

5a1720d39f347548100608.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question