Looking for TVM contributions
|
06-15-2024, 09:52 PM
(This post was last modified: 06-19-2024 02:29 AM by robve.)
Post: #50
|
|||
|
|||
RE: Looking for TVM contributions
(06-15-2024 05:48 PM)robve Wrote: I also implemented a prototype hybrid algorithm. This uses g=3 (g=2 is not as good). Here compared to Secant (with g=2) it performs well: One nice aspect of Secant is that it does not have to deal with the problematic tiny rates where Newton goes haywire (see above and Albert's has extensively posted about this). This updated hybrid method runs about as many npmt evaluations as Newton does, but has no issue with tiny rates and offers mostly higher accuracy (for these tests): ![]() Newton takes 103 evaluations total over all tests, Secant takes 162 evaluations (though they are a bit cheaper), Hybrid takes 104 evaluations and these are cheaper than Newton. The Hybrid method solver is pretty straightforward to compute rate i% (updated to a more robust version): Code: g = 0; // no retries The Secant code is practically the same, but lacks the Newton step and instead uses i/2 for the next point, and with g=2 to repeat and retry if necessary. EDIT: minor edit to correct testing nan(y) instead of nan(i) in the initialization, this can save one unnecessary npmt evaluation when y=nan. - Rob "I count on old friends to remain rational" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 20 Guest(s)