Iterative vs. direct solver


I wrote an article on something to be aware of if you use the HP solver and expect the direct solver to be used, but instead the iterative solver is used.


Hi Don,

Good article. Thanks for posting it.

Yoou are deffinitely the solver king.



Thanks Bill. I'm no king, but I do enjoy using the solver to take advantage of its many capabilities. Years ago, you first turned me onto the "bible" for all things solver, the Technical Applications Manual for the 27s/19b. In fact, at the top of page 14 it discusses what I reported in my article, about the direct solver failing if the variable you are solving for appears more than once formally, and also how to change the reference to the variable so the direct solver will work.

Fascinating stuff. I sure hope the guys who designed that solver got some kind of award/reward for it, they sure deserved it.


The Solver King is Professor Kahan. The King of iterative solution for nonlinear equations ... is .... uhum ... yours truly! It has been a passion and (dare I say obsession) of mine since the mid 70s!!


PS: In fact in the last few months I have been studying the methods for iterative solution of linear systems. The topic is fascinating. The stationary methods are interesting but come with limitations as to what kind of (large) linear systems they can solve. The non-stationary method use conjugate gradient methods to solve the linear systems as an optimization problem. I have been tinkering with the algorithms to solve sets of 500, 1000, and 2000 linear equations. So far, no new discovery :-(

PS2: My lack of modesty is due to jet lag effects, having returned from Europe a few days ago!!

Edited: 18 May 2012, 3:57 a.m. after one or more responses were posted


Care to write a non-linear iterative solver for the 34S :-)

- Pauli


Is the current solver for the 34S inadequate???!!!



I'm not sure, but I am sure it can be improved :)

- Pauli



I can certainly look at the pseudo-code for your solver and see if I can improve it.




The source code is trunk/xrom/solve.wp34s on the subversion site.

I use a combination of quadratic interpolation, Ridder's method, secant and bisection with lots of guards etc. It seems to work okay most of the time but it is the difficult problems that really show up this kind of code.

- Pauli



Do you monitor the sign of the updates in the guess for the root, to guard against the guess resonating between two different regions of values?

Also do you check for low slope values?

Sorry for asking questions that may be trivial to you. These are two general cases of root-seeking problems that come to mind.



Once the two estimates' signs are different I force all future guesses to be within the interval -- I switch to bisection if the more sophicated methods give guesses outside this interval. I know that this will locate discontinuities that across zero but I can live with that. My previous solver used bisection if the split between the new guess and the current bounds was too small but I've stopped doing this -- Ridder's steps seem more effective after a bisection.

I'm not exactly sure what you mean by low slope values -- I do limit the jump distance if both guesses have the same sign to ten times the width between the guesses. I also limit jumps when the function appears constant, although not much.

- Pauli


The low slope (function derivative) value is a problem when using Newton's method. Other methods like Ridder and Bisection are not affected by the slope.



Until the solution is bracketed, I don't use Ridder's or bisection, only secant and quadratic interpolation. Once the solution is bracketed, there is no need to limit the distance jumped -- only to keep future estimates inside the bracketed interval.

I guess I could disable the limiting for quadratic interpolation. Is it a problem here too or not? My gut feeling is quadratic interpolation will be confused too, although not so badly as the secant method -- gut feelings are notoriously fickle though.

- Pauli

Possibly Related Threads...
Thread Author Replies Views Last Post
  hp-prime solver and variable name fabrice48 22 6,880 12-10-2013, 03:25 AM
Last Post: fabrice48
  HP Prime Triangle solver BruceH 29 7,037 11-28-2013, 12:03 AM
Last Post: Dale Reed
  Using units in Numeric Solver Harold A Climer 1 990 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 1,086 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  [HP-Prime CAS] Automatic Simplification (Direct Answer) CompSystems 6 1,727 07-26-2013, 07:20 PM
Last Post: Gilles Carpentier
  Just a lazy solver algortihm PGILLET 1 886 06-28-2013, 11:47 PM
Last Post: Namir
  [43s] : How the solver will be implemented Miguel Toro 3 1,307 03-14-2013, 06:09 PM
Last Post: Walter B
  TVM-Solver for the PC fhub 14 3,280 12-26-2012, 03:24 PM
Last Post: fhub
  [WP34s] New TVM-solver version fhub 43 8,580 12-26-2012, 06:12 AM
Last Post: fhub
  HP-Solver Mike (Stgt) 2 926 10-10-2012, 02:44 AM
Last Post: Mike (Stgt)

Forum Jump: