MATLAB Answers

Shan  Chu
0

error using Solve with inequality

Shan Chu
さんによって質問されました 2019 年 6 月 7 日
最新アクティビティ Shan Chu
さんによって コメントされました 2019 年 6 月 10 日
Hi all,
I am facing a strange problem with using Solve with inequality.
Could you please help?
Thanks
Capture.JPG

  2 件のコメント

Torsten
2019 年 6 月 7 日
Why strange ?
Isn't
4^2-4*4+3 > 0 and 0^2-4*0+3 > 0
as well as
e^2-4*e+3 < 0 and 2^2-4*2+3 < 0
?
Shan Chu
2019 年 6 月 10 日
Hi,
I thought that the solve function would give me the intervals where the inequality is valid.
Instead, it gave me 2 specific values inside those intervals. (of course they are correct).
I saw the document about solve in matlab website. Why shoudn't it give me the intervals like in the website. I included the pics below
Thanks
Capture.JPG

サインイン to comment.

1 件の回答

John D'Errico
回答者: John D'Errico
2019 年 6 月 10 日
編集済み: John D'Errico
2019 年 6 月 10 日
 採用された回答

You did not follow the example carefully.
syms x
>> S = solve(x^2 - 4*x + 3 < 0,'returnconditions',true)
S =
struct with fields:
x: [2×1 sym]
parameters: [1×2 sym]
conditions: [2×1 sym]
>> S.conditions
ans =
1 < x & x < 3
in(y, 'real')
Note the use of returnconditions. Without that, it gives a solution, but not the interval that you desire. So if I drop that property, we get a solution. It is valid, as you say. But just a solution.
S = solve(x^2 - 4*x + 3 < 0)
S =
exp(1)
2

  1 件のコメント

Shan Chu
2019 年 6 月 10 日
Oh I see it now. Thank John.

サインイン to comment.



Translated by