How to solve this equation?
1 回表示 (過去 30 日間)
古いコメントを表示
I have an equation that I'd like to solve for p where 0<a<1. Is there anyone who can help me with this? when I'm running my code it says "Unable to find explicit solution"
syms p a
eqn=2*(p^a)+2*(p^2)+4*(p);
s=solve(eqn,p);
2 件のコメント
Dyuman Joshi
2023 年 6 月 5 日
You don't have an equation, you have an expression. There is no equality in your code. You need to specify the equality and even then, there is no guarantee that solve() will be able to find an explicit symbolic solution.
Walter Roberson
2023 年 6 月 5 日
solve() assumes an implict ==0 for expressions -- which also means that if you have equations of the form f(x)==g(x) then you can rewrite as f(x)-g(x)==0 and then drop the ==0 to pass in just f(x)-g(x)
採用された回答
Walter Roberson
2023 年 6 月 5 日
There are multiple solutions. p=0 is a solution for all a values, but there are also complex solutions -- and you did not rule out complex solutions.
You are not going to be able to get a closed form solution for an equation involving sums with a value to an unknown power -- except in the limited situation where the equation happens to match a pattern that can be solved with a wrightOmega
syms p
a = sym(linspace(eps, 1-eps, 20),'f')
eqns = 2*(p.^a) + 2*(p^2) + 4*(p);
sols = arrayfun(@(E)vpasolve(E,p,-100), eqns, 'uniform', 0)
hold on;
cellfun(@(A,S) plot(repmat(A, numel(S), 1), real(S), 'k+'), num2cell(a), sols);
cellfun(@(A,S) plot(repmat(A, numel(S), 1), imag(S), 'r*'), num2cell(a), sols);
hold off
a(end),sols{end}
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!