[wp34s] Poly root finders?
12-07-2015, 08:05 PM (This post was last modified: 12-07-2015 08:26 PM by fhub.)
Post: #14
 fhub Member Posts: 188 Joined: Dec 2013
RE: [wp34s] Poly root finders?
(12-07-2015 05:40 PM)emece67 Wrote:  Well, I think I understand it except for the very last lines.
...
What are they for?
OMG, do you really expect that I remember this after almost 4 years?

Well, after a quick look at the code I think it was about getting 'prettier' results (in some cases).
Assume that any root of the polynomial is exactly 2.345, but since this is an approximate method it may finish with a value of 2.34499999.....99978 (with the used eps=1e-15 the inaccuracy should happen around digit 15 internally).
Now I round this value to 12 digits and to 10 digits, and if these rounded values (in this case both would be 2.345000...) are identical, I just use this rounded value instead of the 15-digit approximation.

[Edit:] Many testsuites for polynomial rootsolvers even use examples with integer roots, e.g. (x-2)^10 or (x-1)*(x-2)*(x-3)*... etc., and with my rounding routine I get indeed exact results.

Franz
 « Next Oldest | Next Newest »

 Messages In This Thread [wp34s] Poly root finders? - emece67 - 12-03-2015, 06:22 PM RE: [wp34s] Poly root finders? - BarryMead - 12-03-2015, 10:04 PM RE: [wp34s] Poly root finders? - Thomas Klemm - 12-03-2015, 11:43 PM RE: [wp34s] Poly root finders? - fhub - 12-04-2015, 09:34 AM RE: [wp34s] Poly root finders? - Dieter - 12-04-2015, 11:50 AM RE: [wp34s] Poly root finders? - fhub - 12-04-2015, 12:04 PM RE: [wp34s] Poly root finders? - Dieter - 12-04-2015, 12:32 PM RE: [wp34s] Poly root finders? - fhub - 12-04-2015, 12:53 PM RE: [wp34s] Poly root finders? - emece67 - 12-04-2015, 12:58 PM RE: [wp34s] Poly root finders? - fhub - 12-04-2015, 01:07 PM RE: [wp34s] Poly root finders? - emece67 - 12-04-2015, 01:23 PM RE: [wp34s] Poly root finders? - fhub - 12-04-2015, 01:30 PM RE: [wp34s] Poly root finders? - emece67 - 12-07-2015, 05:40 PM RE: [wp34s] Poly root finders? - fhub - 12-07-2015 08:05 PM RE: [wp34s] Poly root finders? - walter b - 12-07-2015, 08:50 PM RE: [wp34s] Poly root finders? - emece67 - 12-07-2015, 09:59 PM RE: [wp34s] Poly root finders? - fhub - 12-07-2015, 10:56 PM RE: [wp34s] Poly root finders? - emece67 - 12-07-2015, 11:19 PM RE: [wp34s] Poly root finders? - Dieter - 12-08-2015, 06:49 AM

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