The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
This system has not solution. The lsolve must return an error message, not solution!
What do you think about this?
Solved! Go to Solution.
@ValeryOchkov wrote:
I think it is an error! Wrong answer is more badly as an error message!
Its not an error, its just a function which behaves differently than you expected.
You won't call an answer given by "MinErr" as being wrong. You don't do this, because you know that "minerr" is not necessarily returning an exact solution to a problem but does its best to give you a "close solution".
The same is true with "lsolve". The difference only is, that you did not know that it also may give you just a close solution and not an exact one.
Of course you are free to think that a function with the word "solve" in its name should not be allowed to return an inexact (wrong?) least-square solution but rather should return an error in case of an inconsistent system. This may be a matter of personal taste and you can always open a case with PTC support and wait for them to change the algorithm behind "lsolve" - Good luck! 🙂 👿
I wouldn't get upset myself. I can live with the fact that the documentation clearly describes that "lsolve" may also provide approximate solutions and can remember that (well, hopefully I can remember that) and use the function accordingly.
My point was: Its not a bug, its not wrong, its not an error - it works as specified!
It's a BUG in Prime!
Mathcad 11/Maple agrees with you:
In Prime Express the lsolve function is a Premium function, so not available.
That can be amended with:
And that gives:
Much better than an expensive full license...
Success!
Luc
Sorry, Luc!
We can not have an inverse matrix from not square matrix!
Read please your error message!
For those of us with Express that require pseudo inverses of non-square matrices.
I read the P7 online help info on lsolve (thanks Werner). It appears that the geninv() function is not premium, so the implementation of lsolve for Prime Express can be done with:
Then:
QED.
Luc
Если нельзя, но очень хочется, то можно!
IMHO its not a bug and lsolve just works as expected!
According to the help its not necessary for M to be square and in case of an inconsistent system lsolve switches to a least-square solution (similar to geninv). Given Luc's screenshot of MC11 it looks like implementation has changed somewhere on the way from MC11 to MC14.
For more information about the usage and algorithm used you may look it up in "Numerical Recipes" and study the Mathcad E-Book "Inside Mathcad: Solving" (not available for Prime, of course).
Playing around with MC15:
From MC15's help:
I think it is an error! Wrong answer is more badly as an error message!
@ValeryOchkov wrote:
I think it is an error! Wrong answer is more badly as an error message!
Its not an error, its just a function which behaves differently than you expected.
You won't call an answer given by "MinErr" as being wrong. You don't do this, because you know that "minerr" is not necessarily returning an exact solution to a problem but does its best to give you a "close solution".
The same is true with "lsolve". The difference only is, that you did not know that it also may give you just a close solution and not an exact one.
Of course you are free to think that a function with the word "solve" in its name should not be allowed to return an inexact (wrong?) least-square solution but rather should return an error in case of an inconsistent system. This may be a matter of personal taste and you can always open a case with PTC support and wait for them to change the algorithm behind "lsolve" - Good luck! 🙂 👿
I wouldn't get upset myself. I can live with the fact that the documentation clearly describes that "lsolve" may also provide approximate solutions and can remember that (well, hopefully I can remember that) and use the function accordingly.
My point was: Its not a bug, its not wrong, its not an error - it works as specified!
OK! The error is in word solve in the function lsolve name! Better is the LMinErr name!
Как корабль назовешь - так он и поплывет!
It is a name the chapter 23 of my book!
2⁵ Problems for STEM Education - 1st Edition - Valery Ochkov - Rout (routledge.com)
The Mathcad 11 handbook says:
The phrasing: "Returns a solution vector x such that M*x=v." leaves no room for approximations.
As of Mathcad 12 the overview table of functions has disappeared from the manual. And as shown by you, they've changed the functionality.
Luc
The phrasing: "Returns a solution vector x such that M*x=v." leaves no room for approximations.
That depends on how you'd like to define "solution" in case of a non-consistent system and if you'd like to accept a least square solution as being a "solution".
But I, too, think that "lsolve" is a somewhat misleading name for a function which may return just a least square fit.
It's not so much the definition of 'solution'. If the problem is: "Give the closest value of x such that M*x approximates v." then an approximated x can be a good solution to that problem.
It's the fact that x must be such that M*x = v. That's an 'equals' not 'approximates'.
Luc
The lsolve function must work as a Find function!
@ValeryOchkov wrote:
The lsolve function must work as a Find function!
This may be your opinion which is to be respected.
But the developers of Mathcad (after V11) had a different opinion and implemented a more generic algorithm.
So, as already written above, lsolve works like MinErr on purpose and can be used that way for inconsistent systems, too.
So the function works as intended and specified.