41C/CV root finders
|
05-30-2015, 12:37 PM
(This post was last modified: 05-30-2015 12:46 PM by Dieter.)
Post: #45
|
|||
|
|||
RE: 41C/CV root finders
(05-29-2015 07:19 PM)I Wrote: Let's see if there is a similar way to optimize the implementation of the formulas you use. ;-) There is a similar method like the one suggested in post #13. The calculation of your f(i) and f'(i) could get implemented this way: Code: Let Afterwards –f(i) is divided by f'(i) and this quotient is the delta_i that is then added (!) to the previous estimate. Now every iteration requires just one ln1+x and one e^x-1, the formulas are shorter and maybe even more accurate. Regarding cases with no solutions and infinite looping: I think there is a better way than a simple loop counter. The value of abs(delta_i) could be saved in each loop and get compared to one from the previous iteration. If it is larger, i.e. the iteration is divergent, the program may exit with an error message. I am currently testing this in a 35s program. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)