Post Reply 
41C/CV root finders
05-22-2015, 08:34 AM (This post was last modified: 05-22-2015 08:42 AM by Dieter.)
Post: #11
RE: 41C/CV root finders
(05-21-2015 07:36 PM)Dieter Wrote:  I already suggested the method in post #7 of the older thread linked in my previous post. Here is a quick and dirty implementation of that idea. Try it and see what you get.

FTR, here is another version with a different definition of the TVM equation. It is shorter, runs faster and may require slightly less iterations here and there. Maybe you want to try this as well. Lines 01...29 are the same as before, here is the new code from line 30:

Code:
.. ...
30 LBL 01
31 RCL 04
32 RCL 03
33 FS? 01
34 +
35 RCL 04
36 RCL 07
37 /
38 +
39 STO 08    // a = pv + pmt/(i%/100) ( + pmt for END)
40 RCL 07
41 LN1+X
42 RCL 01
43 *
44 E^X-1
45 STO 09    // b = (1+i%/100)^n - 1
46 *
47 RCL 03
48 +
49 RCL 05
50 +         // = TVM
51 RCL 09
52 1
53 +
54 RCL 07
55 1
56 +
57 /
58 RCL 01
59 *
60 RCL 08
61 *
62 RCL 04
63 RCL 09
64 *
65 RCL 07
66 x^2
67 /
68 -         // = TVM'
69 /         // = correction term
70 ST- 07    // adjust i%/100
71 RCL 07
72 /
73 ABS       // = abs(relative error)
74 100
75 +
76 LASTX
77 X#Y?      // is relative error not yet below 5 E-8 ?
78 GTO 01    // then do another iteration
79 RCL 07
80 *         // calculate i% (here Y still holds the 100 from step 85/87)
81 LBL 99
82 STO 02    // save result in R02
83 END       // and exit

The standard problem was solved with just four iterations (instead of five before) in about 10 seconds.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
41C/CV root finders - Dave Britten - 05-20-2015, 07:07 PM
RE: 41C/CV root finders - Thomas Klemm - 05-20-2015, 07:36 PM
RE: 41C/CV root finders - Dieter - 05-20-2015, 07:44 PM
RE: 41C/CV root finders - Dave Britten - 05-20-2015, 08:08 PM
RE: 41C/CV root finders - Massimo Gnerucci - 05-20-2015, 08:40 PM
RE: 41C/CV root finders - Dave Britten - 05-20-2015, 08:49 PM
RE: 41C/CV root finders - Didier Lachieze - 05-21-2015, 11:12 AM
RE: 41C/CV root finders - Dieter - 05-21-2015, 11:40 AM
RE: 41C/CV root finders - Dave Britten - 05-21-2015, 12:51 PM
RE: 41C/CV root finders - Dieter - 05-21-2015, 07:36 PM
RE: 41C/CV root finders - Dieter - 05-22-2015 08:34 AM
RE: 41C/CV root finders - bshoring - 05-27-2015, 10:09 PM
RE: 41C/CV root finders - Dieter - 05-27-2015, 11:16 PM
RE: 41C/CV root finders - Ángel Martin - 05-28-2015, 06:19 AM
RE: 41C/CV root finders - Dieter - 05-28-2015, 08:42 AM
RE: 41C/CV root finders - bshoring - 05-28-2015, 09:37 PM
RE: 41C/CV root finders - Ángel Martin - 05-22-2015, 01:14 PM
RE: 41C/CV root finders - Dieter - 05-22-2015, 07:07 PM
RE: 41C/CV root finders - Dieter - 05-24-2015, 07:10 PM
RE: 41C/CV root finders - Ángel Martin - 05-25-2015, 05:35 AM
RE: 41C/CV root finders - Dieter - 05-25-2015, 07:19 PM
RE: 41C/CV root finders - Ángel Martin - 05-26-2015, 05:06 AM
RE: 41C/CV root finders - Dieter - 05-26-2015, 05:39 PM
RE: 41C/CV root finders - Ángel Martin - 05-26-2015, 09:26 PM
RE: 41C/CV root finders - Dieter - 05-26-2015, 10:08 PM
RE: 41C/CV root finders - rprosperi - 05-27-2015, 12:30 AM
RE: 41C/CV root finders - Dieter - 05-27-2015, 11:08 PM
RE: 41C/CV root finders - Ángel Martin - 05-28-2015, 05:44 AM
RE: 41C/CV root finders - Dieter - 05-28-2015, 09:50 PM
RE: 41C/CV root finders - Ángel Martin - 05-29-2015, 07:58 AM
RE: 41C/CV root finders - Ángel Martin - 05-27-2015, 05:17 AM
RE: 41C/CV root finders - Dieter - 05-27-2015, 01:50 PM
RE: 41C/CV root finders - Ángel Martin - 05-27-2015, 03:03 PM
RE: 41C/CV root finders - Dieter - 05-27-2015, 07:15 PM
RE: 41C/CV root finders - Dieter - 05-28-2015, 09:59 AM
RE: 41C/CV root finders - Ángel Martin - 05-28-2015, 11:27 AM
RE: 41C/CV root finders - Ángel Martin - 05-28-2015, 01:54 PM
RE: 41C/CV root finders - Dieter - 05-28-2015, 06:33 PM
RE: 41C/CV root finders - Ángel Martin - 05-29-2015, 08:04 AM
RE: 41C/CV root finders - Ángel Martin - 05-29-2015, 05:54 PM
RE: 41C/CV root finders - Dieter - 05-29-2015, 06:15 PM
RE: 41C/CV root finders - Ángel Martin - 05-29-2015, 06:44 PM
RE: 41C/CV root finders - Dieter - 05-29-2015, 07:19 PM
RE: 41C/CV root finders - Dieter - 05-30-2015, 12:37 PM
RE: 41C/CV root finders - Ángel Martin - 05-30-2015, 02:04 PM
RE: 41C/CV root finders - Dieter - 05-29-2015, 08:00 PM



User(s) browsing this thread: 4 Guest(s)