Strict inequalities are not supported (learn why)
24 次查看(过去 30 天)
显示 更早的评论
Hello everyone
I need your help please , I am student and am working in LQR control by LMI
i face probleme with inequalities , firstly i was thinking that becose the version of matlab 2020 but now i am working with 2024
2 个评论
Walter Roberson
2024-6-25
Are you talking about the fact that for various routines you can put on restrictions A*x <= b, and A*x == b, but not A*x < b ?
回答(1 个)
John D'Errico
2024-6-25
编辑:John D'Errico
2024-6-25
It is NOT related to the release number. Sorry. That has nothing to do with it. This has been the case since release 0 of MATLAB. (To be pedantic, back then, they were called versions, not releases as I recall. And I'm not sure what the first version was, since the first one I had was either version 1 or version 3. I had them both, but I did not really start using MATLAB until version 3.)
A strict inequality, something of the general form x > a, relies on knowing ALL of the digits of a number. And the problem is, even for a number like 1/3, you cannot store that number exactly in floating point arithmetic. And worse, any computations done using floating point numbers end up having some slop in them, in the least significant bits. We can see the perfect axample here:
0.3 - 0.1 - 0.2 == -0.2 - 0.1 + 0.3
Now surely that is a mathematical equality, right? And since we are talking strict inequalities, this next one yields a true result!
0.3 - 0.1 - 0.2 > -0.2 - 0.1 + 0.3
How could that possibly be true? Another example you should consider is this one:
1 + 1e-20 > 1
Now, surely that should have be true, right? At least it must be true if a strict inequality could ever be employed in any code. In fact, as far as double precision arithmetic is concerned, we have this counter-intuitive result instead:
1 + 1e-20 == 1
Again, you cannot trust the least significant bits of a floating point number. (Well, at least not unless you fully understand everything I have written here, and far more about floats and how to work with them. And even then, don't trust the least significant bits. And since you asked this question, you are not even close to that point.)
All of this gets worse when you are working with linear algebra, where many hundreds, thousands, or millions of adds, subtracts and multiplies are performed. The point is, asking for a STRICT inequality to be recognized and enforced is impossible.
3 个评论
John D'Errico
2024-6-26
This is a compeltely different question. Ask it in a new question, as otherwise, you make this question into a long random thread that just asks for gneral consulting.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Matrix Inequalities 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!