How to get the discriminant for symbolic quadractice equation?

13 ビュー (過去 30 日間)
Dinh Le Dung
Dinh Le Dung 2022 年 8 月 18 日
編集済み: Torsten 2022 年 8 月 18 日
I got a quadractic equation save in f.
How can i calculate d= b^2-4ac from that equation?
  1 件のコメント
Chunru
Chunru 2022 年 8 月 18 日
Include code instead of screen capture.

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

回答 (1 件)

Torsten
Torsten 2022 年 8 月 18 日
編集済み: Torsten 2022 年 8 月 18 日
I guess you mean d = b^2-4*a*c if the polynomial is given by p(x)=a*x^2+b*x+c. So the a and b in the discriminant have nothing to do with your symbolic variables a and b, do they ?
syms a b x y x2 y2
f = x2/a^2 + y2/b^2;
f1 = x2 + y2 - 2*y;
x2_sol = solve(f==1,x2);
f1 = subs(f1,x2,x2_sol);
f1 = subs(f1,y2,y^2);
c = coeffs(f1,y);
d = c(2)^2-4*c(1)*c(3)
d = 

カテゴリ

Help Center および File ExchangeQuadratic Programming and Cone Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by