Symbolic Math toolbox does not solve equation

5 ビュー (過去 30 日間)
BW
BW 2025 年 2 月 17 日
コメント済み: BW 2025 年 2 月 24 日
Hello everyone, I am attempting to solve an equation via the Symbolic Math toolbox:
syms a b c d e
solve([a^2 + b*c == d^2, b*c==e*a^2],e)
ans =
Empty sym: 0-by-1
However, I seem to be unable to move the solver to produce the correct soluation (d^2-a^2)/a^2.
What am I doing wrong here, and how should I formulate this problem for the solver to work?
Thank you for every hint on this!

採用された回答

Harald
Harald 2025 年 2 月 20 日
Hi,
since you supply two equations, you would also need to solve for two variables.
To let MATLAB do what you did, you could use:
syms a b c d e
s1 = solve(b*c==e*a^2,e);
s2 = solve(a^2 + b*c == d^2, b);
s = simplify(subs(s1, b, s2))
s = 
or
syms a bc d e
s1 = solve(bc==e*a^2,e);
s2 = solve(a^2 + bc == d^2, bc);
s = subs(s1, bc, s2)
s = 
Best wishes,
Harald
  1 件のコメント
BW
BW 2025 年 2 月 24 日
Thank you for your help Harald, totally makes sense^^

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

その他の回答 (0 件)

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!