Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi Guys,
I am trying to use solver block to find 2 variables. The solver says the solution cannot be found even though the solution exists. Please help me out by checking the constraints.
Thanks,
Solved! Go to Solution.
For better clearness the solve block should only contain the guess values, equations to solve and constraints. All the rest outside and above.
You have three equations but want to solve for two variables only. This may work, but most of the time doesn't. In your case it doesn't. Prime will only find a solution if I disable one of the equations and also one of the constraints:
Using all equations and constraints works if you use "minerr" instead of "find":
For better clearness the solve block should only contain the guess values, equations to solve and constraints. All the rest outside and above.
You have three equations but want to solve for two variables only. This may work, but most of the time doesn't. In your case it doesn't. Prime will only find a solution if I disable one of the equations and also one of the constraints:
Using all equations and constraints works if you use "minerr" instead of "find":
Thanks Werner, what is the difference between find and minerr function? When shall I use each of them?
why does the find function unable to solve the problem?
"find" tries to find a solution (within a certain tolerance) which fulfills ALL equations and constraints.
"minerr" tries to find values where the sum of (squared) errors with respect to the equations and constraints is minimized. Usually no equation/constraint is exactly fulfilled exactly. So its no problem if you demand more equations than variables to be "fulfilled".
From the help:
minerr differs from find or minimize in that, if the chosen algorithm fails to converge, whatever answer found on the last allowable iteration is returned, even if it doesn't meet the convergence criteria. If convergence occurs, then minerr returns the same results as find.
BTW, one of your constraints seems to be hard to fulfill: