Problem Solving Symbolic Inequalities
28 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to use Matlab to solve inequalities like the example below, but only have partial sucess, with other times getting the result shown below.
EDU>> solution=solve('((k1^2 + 1080.0*k1 - 2948400.0)/(k1 - 4660.0))>0')
solution = matrix([[solve([0.0 < (k1^2 + 1080.0*k1 - 2948400.0)/(k1 - 4660.0)], [k1])]])
I know that the solutions for this example are -2340<k1<1260 & k1>4660, is there something that I can do differently to make this work in Matlab? Thanks.
0 件のコメント
採用された回答
Stefan Wehmeier
2012 年 3 月 19 日
Note that by default solve is in complex mode, i.e., you are looking for all solutions within the complex numbers. Try
solution=feval(symengine, 'solve', '((k1^2 + 1080.0*k1 - 2948400.0)/(k1 - 4660.0))>0', 'k1', 'Real')
2 件のコメント
Alexander
2012 年 3 月 19 日
|solve| also supports the option |real|, so you don't need |feval|:
solution = solve('((k1^2 + 1080.0*k1 - 2948400.0)/(k1 - 4660.0))>0', 'Real', true)
filston Rukerandanga
2020 年 7 月 14 日
Confirmed, the option 'real', solved my problem. Before it was giving me a warning like :
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
% So here is my working code
syms n
eq1 = -10*log10(abs(1/(1 + (.25)^(2*n))))<=0.05;
eq2 = -10*log10(abs(1/(1 + (2)^(2*n))))>10;
eq1 = rewrite( -10*log10(abs(1/(1 + (.25)^(2*n))))<=0.05,'log');
eq2 = rewrite(-10*log10(abs(1/(1 + (2)^(2*n))))>10, 'log');
soln = solve(eq1,eq2, n, 'IgnoreAnalyticConstraints',1,'real',1);
n = vpa(soln)
その他の回答 (1 件)
Walter Roberson
2012 年 3 月 14 日
Symbolic solvers are notoriously poor at inequalities. All except the long-gone Axiom: it was supposedly good.
In the particular case above, Maple 15 gives the solution as
RealRange(Open(-2340), Open(1260))
RealRange(Open(4660), infinity)
In general, though, what I usually end up doing is transforming the inequality in to an equality by introducing a variable that I add constraints on to:
syms k1
syms c positive
solve( ((k1^2 + 1080.0*k1 - 2948400.0)/(k1 - 4660.0)) - c, k1)
Since the assumed-positive value c needs to be subtracted for the expression to equal 0, then that is equivalent to saying that the result of the expression (without the "- c") must be positive.
There have been a fair number of expressions in Maple that I could not get anywhere on until I substituted a particular number (symbolic) as the difference and made the expressions in to equalities.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!