フィルターのクリア

How to check if a symbolic function is positive or negative?

21 ビュー (過去 30 日間)
Andrea Strappato
Andrea Strappato 2021 年 9 月 29 日
コメント済み: Andrea Strappato 2021 年 9 月 29 日
Hi everyone,
I've defined a square function this way:
sym x
y = x^2
Running the command ' isAlways(y>=0) ' I get:
Warning: Unable to prove '0 <= x^2'.
> In symengine
In sym/isAlways (line 42)
Why Matlab is displaying the warning?
Thanks in advance for who will help me!

採用された回答

Steven Lord
Steven Lord 2021 年 9 月 29 日
MATLAB is unable to prove that y is always greater than or equal to 0 because y is not always greater than or equal to 0. Here is a case where it is:
x = 1;
y = x^2
y = 1
y >= 0 % true
ans = logical
1
Here is a case where it is not.
x = 1i;
y = x^2
y = -1
y >= 0 % false
ans = logical
0
If you told MATLAB that x was real, it would help.
syms x real
y = x^2
y = 
isAlways(y >= 0)
ans = logical
1

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by