why I get imaginary part using solve function

2 ビュー (過去 30 日間)
Sarah Alhabbas
Sarah Alhabbas 2022 年 6 月 14 日
コメント済み: Walter Roberson 2022 年 6 月 14 日
I am trying to use the solve function but somehow I keep getting more than one answer with imaginary parts and negative numbers
the correct answer should be the second answer = 0.85
  1 件のコメント
Torsten
Torsten 2022 年 6 月 14 日
編集済み: Torsten 2022 年 6 月 14 日
If you multiply eq4 by (1+y*m4^2)^2, you get a polynomial equation of degree 4 in m4. This equation has 4 zeros (which are listed in the output of vpasolve). Two of them are purely imaginary, two of them are real. One of the solution is the one you want (the second one).

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2022 年 6 月 14 日
You have an expression of the form f(x^4)/g(x^2) + b = 0
Multiply through by g(x^2) (assuming nonzero) to get
f(x^4) + b*g(x^2) = 0
collect x terms to get a polynomial in x^4.
Solve the degree 4 polynomial, getting four solutions.
Therefore "the answer" is all four solutions, not just a single solution.
If you have constraints on the outputs, such as being real valued, then filter the results.
  3 件のコメント
Torsten
Torsten 2022 年 6 月 14 日
y = 1.4;
to3 = 300;
t_star = 400;
syms m4
eq4 = (((2*(y+1)*m4^2*(1+(y-1)/2)*m4^2))/(1+y*m4^2)^2) - to3/t_star;
m4 = vpasolve(eq4,m4);
m4 = m4(abs(imag(m4)) < eps & real(m4) > 0)
m4 = 
0.85395841885781973634525216634996
Walter Roberson
Walter Roberson 2022 年 6 月 14 日
y = 1.4;
to3 = 300;
t_star = 400;
syms m4 positive
eq4 = (((2*(y+1)*m4^2*(1+(y-1)/2)*m4^2))/(1+y*m4^2)^2) - to3/t_star;
m4 = solve(eq4,m4);
m4
m4 = 
vpa(m4)
ans = 
0.85395841885781973634525216634996

サインインしてコメントする。

その他の回答 (1 件)

David Hill
David Hill 2022 年 6 月 14 日
y=1.4;
to3=300;
t_star=400;
eq4=@(m4)(((2*(y+1)*m4^2*(1+(y-1)/2)*m4^2))/(1+y*m4^2)^2)-to3/t_star;
m_4=fzero(eq4,.8)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by