Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi guys,
I have a relatively simple solve block here but i'm getting answers that don't seem to be the right magnitude and the answers that I am getting are changing when i change the guess values which im very confused about. I've always thought the guess value didn't matter. Any help would be appreciated.
Thanks.
The answers you are getting satisfy your equations (this is easy to check, and it's always a good idea to do so), so if they are in some way incorrect then it's because you have framed the problem incorrectly. In particular, I notice that you are not using units on any of your quantities, so maybe it's a unit scaling factor?
A numeric non-linear solver is iterative, so the guess values do indeed matter (if they didn't, you would not need to give any ). A system of non-linear equations can have more than one solution, and which solution is found will depend on the starting point of the iterative procedure. This is further compounded by the fact that a solution does not require all the equations to be satisfied perfectly. The error only has to be less than the built-in variable CTOL. This means that even if the system of equations has only one true solution, the numeric solver may find more than one. Your numbers are small, and the default value of CTOL is only 10^-3, so put CTOL:=10^-9 above your solve block and it will be less susceptible to the starting guesses.
Lastly, P.NFunN appears only on the LHS of the first equation, so this equation does not need to be in the solve block. Just solve for L1, L4, and A.p using the other three equations, and then find P.NFunN by a simple numerical assignment.
Graeme Cochrane wrote:
Hi guys,
I have a relatively simple solve block here but i'm getting answers that don't seem to be the right magnitude and the answers that I am getting are changing when i change the guess values which im very confused about. I've always thought the guess value didn't matter. Any help would be appreciated.
Thanks.
I have no idea why you think that the magnitude of your numeric solutions is wrong. I have solved your system symbolically and got the very same results. Numeric solving uses an approximation algorithm (by default Levenberg-Marquardt) and so it should be no surprise that you might get different solutions when you change the guess values. Otherwise guess values wouldn't be necessary at all (as is the case with symbolic solution.
Could it be that something is wrong with your equations? At least you are providing two values which are not used in your calculation at all.