Post Reply 
1-AUG-2019 SolveSys - Equation Library and Nonlinear Systems Solver
02-16-2017, 02:46 AM (This post was last modified: 02-16-2017 04:35 AM by Han.)
Post: #22
RE: SolveSys - Equation Library and Multiple Equations Solver
So I found the issue -- it was in the line search. There was a missing line of code in the cubic approximation of function \( g(\lambda) = f(\mathbf{x} + \lambda \cdot \mathbf{\Delta x}) \) (as referenced in Numerical Recipes, Art of Scientific Computing). This lead to "bad guesses" when the guess was actually just fine. In fact, your earlier post with A=2 and B=1 tested out just fine with the correction. I had too quickly dismissed this guess as a bad guess because of the nature of the system (not smooth) and because the solutions were so tiny (I just dismissed the issue as a precision issue).

There is, however, a division by 0 problem. Some of the "tricks" used to reduce the number of calculations ended up costing me numerical stability. For example, \(f + f_\text{old} \cdot (2\lambda -1) \) is 0 when \( f \), \( f_\text{old} \), and \( \lambda \) are all very tiny. On the other hand, \( f - f_\text{old} + 2 \cdot \lambda \cdot f_\text{old} \) preserves many more significant digits even if \( \lambda\) is significantly smaller than \( f \) or \( f_\text{old} \). The former sometimes leads to division by 0 whereas the latter keeps us slightly safer.

Thank you for your dedication to testing the program. It is always nice to have extra sets of eyes checking to make sure all is in good order. Updates to be posted soon.

PS: I forgot to mention this, but I put in a number of debugging snippets of code to help with the testing. If you need to see the messages that are output during the solving portion, use:


I keep a copy in G1 for this specific purpose. This way you can always see the most recent messages just before the program ends in any unexpected way.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: SolveSys - Equation Library and Multiple Equations Solver - Han - 02-16-2017 02:46 AM
Not able to solve a system - rrpalma - 05-05-2019, 08:10 PM

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