# # canola - canon canola 1614p emulator # Copyright (C) 2011 Peter Miller # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 3, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # ; ; ---------- Card-Pocket-Begin ------------------------------------------- ; Title: Cube Root by Halley's Method, by P. Miller ; Style: aus ; Disassemble: true ; ---------- Card-Pocket-End --------------------------------------------- ; ; The method used here is actually an application of a method devised by ; comet discoverer Edmond Halley (see Halley's Method). Over the years ; it has been repeatedly rediscovered and attributed to others including ; Lambert and Bailey. It has cubic convergence, which is better than ; Newton-Raphson quadratic convergence. ; ; solve: x**3 - a = 0 ; ; x2 = x1 * ((x1**3 + a) + a) / (x1**3 + (x1**3 + a)) ; ; See Also ; https://en.wikipedia.org/wiki/Halley%27s_method ; sfj $210 sm14 ; a => m14 sqrt sqrt ; first approximation is 4th root sm13 ; x1 => m13 fj $210 rm13 * += * rm13 += sm12 ; x1**3 => m12 rm14 += sm11 ; x1**3 + a => m11 rm12 += sm10 ; (x1**3 + (x1**3 + a)) => m10 rm11 rm14 += ; ((x1**3 + a) + a) * rm13 / ; x1 * ((x1**3 + a) + a) rm10 += ; x2 rm13 rv sm13 -= ; x2 - x1 * .1 += mj $210 sc mj $210 rm13 srj