|
Well Walter's got his answer for the cube root,
hopefully he's using RPGIV (higher math is painful without it.) If for whatever
reason RPGIII is all you've got:
Richard Jackson's and Jim Langston's methods for
the cube root are linear interpolation. Newton's method converges
faster.
Newton's iterative formula for the cube root of
r is:
x(n) = x(n-1) - (x(n-1) ** 3 - r) /
3*x**2(n-1)
where:
x(n) is the next approximation x(n-1) is the previous approximation x(0) is the initial guess x(n-1)**3 = x(n-1) * x(n-1) *
x(n-1)
x(n-1)**2 = x(n-1) * x(n-1) We're lucky in that x**3 - r has only one (real)
root, so plugging in any value except zero for the initial guess will
work
--Andy
__________________________________________
Andrew H. Warren Senior Systems Analyst IBM Certified Specialist-RPGIV Developer Ottaway Newspapers Inc. Campbell Hall, New York __________________________________________ |
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.