My query is to get roots with positive real part of an equation having variable real coefficients. An example is given below.
1 回表示 (過去 30 日間)
古いコメントを表示
Sukhversha Luthra
2017 年 9 月 5 日
コメント済み: Sukhversha Luthra
2017 年 9 月 7 日
clc;
w = sym('w','real');
C=1;B=2*w;A=2;
P=[C 0 -B 0 A];
R=roots(P);
Real_R=real(R);
alpha=Real_R(Real_R>0);
disp(alpha)
0 件のコメント
採用された回答
John D'Errico
2017 年 9 月 5 日
Why use roots here? Roots is for purely numerical problems. Worse, roots provides only ONE set of roots. You are looking to find an entire family of roots, under the condition that x has a real positive part.
syms x
w = sym('w','real');
C=1;B=2*w;A=2;
P = C*x^4 - B*x^2 + A;
r = solve(P,x)
r =
-(w + (w^2 - 2)^(1/2))^(1/2)
(w - (w^2 - 2)^(1/2))^(1/2)
-(w - (w^2 - 2)^(1/2))^(1/2)
(w + (w^2 - 2)^(1/2))^(1/2)
We can see, for example, that the roots are defined for all w. But if you insist on a real positive part for a root, then only a limited domain for w will yield real roots for x. And that domain in w will probably vary for each of those 4 roots.
Remember that each of the square roots in the expressions for the roots above are principal square roots. So we take the positive branch of the sqrt function in each of those cases. And since w lives only on the real line, we can investigate for which values of w does that root have a real positive part.
Consider the first root. A little thought should convince you that this root will NEVER have a real positive part for real w, if the principal square roots are used. If you are too lazy, and wish to be convinced, try a plot:
ezplot(@(w) real(-(w + (w.^2 - 2).^(1/2)).^(1/2)),[-10,20])
How about the second root? Again, some careful thought here will convince you this one only has a positive real part if w > -sqrt(2). Yes, that is -sqrt(2).
The third root is similar to the first one. It appears to have always a negative real part, where any real part exists.
Finally, the 4th root requires that w>-sqrt)2) for a positive real part to exist.
So two of those roots do what you want, but ONLY when w>-sqrt(2).
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Particle & Nuclear Physics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!