Solving Inequalities using symbolic tool box

조회 수: 63 (최근 30일)
Jagadeesh Korukonda
Jagadeesh Korukonda 2023년 10월 28일
댓글: Walter Roberson 2023년 10월 31일
When I try to solve simple inequality
let say
the solution is
but matlab is giving wierd answers
syms x
solve(x^2 - 25>0,x)
ans = 
can somone help me, how to fix this issue?
  댓글 수: 2
Torsten
Torsten 2023년 10월 28일
syms x real
sol = solve(x^2 - 25>0,x,'ReturnConditions',1);
sol = struct with fields:
x: [2×1 sym] parameters: x conditions: [2×1 sym]
sol.x(1)
ans = 
x
sol.x(2)
ans = 
x
sol.conditions
ans = 
Jagadeesh Korukonda
Jagadeesh Korukonda 2023년 10월 31일
Thanks @Torsten

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 10월 31일
It is common with the symbolic engine that in practice you need to convert inequalities into equalities by introducing a non-negative or a positive "excess" variable -- so if f(x) > y(x) then f(x) - y(x) > 0; let δ quantify how much more so f(x) - y(x) = delta for positive delta. Now you can try to solve() your system for the other variables and you will get back a system of solutions in terms of the quantified-excess variables
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 10월 31일
syms x real
syms delta positive
eqn = x^2 - 25 == delta %amount difference of terms is greater than 0
eqn = 
sol = solve(eqn, x)
sol = 

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by