How to solve this equation?

3 views (last 30 days)
Della
Della on 5 Jun 2023
Answered: Walter Roberson on 5 Jun 2023
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 Comments
Dyuman Joshi
Dyuman Joshi on 5 Jun 2023
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
Walter Roberson on 5 Jun 2023
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)

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 5 Jun 2023
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')
a = 
eqns = 2*(p.^a) + 2*(p^2) + 4*(p);
sols = arrayfun(@(E)vpasolve(E,p,-100), eqns, 'uniform', 0)
sols = 1×20 cell array
Columns 1 through 7 {[- 1.000000018675…]} {[- 1.276881684015…]} {[- 1.397919366591…]} {[- 1.499530104971…]} {[- 1.593743226079…]} {[- 1.685062313890…]} {[- 1.775741013081…]} Columns 8 through 14 {[- 1.867080012385…]} {[- 1.959877598644…]} {[- 2.054611315759…]} {[- 2.151509926327…]} {[- 2.250569694613…]} {[- 2.351534910499…]} {[- 2.453849153663…]} Columns 15 through 20 {[- 2.556577477736…]} {[- 2.658296214598…]} {[- 2.756945177594…]} {[- 2.849636776102…]} {[- 2.932419250129…]} {[- 2.999999999999…]}
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}
ans = 
ans = 

More Answers (0)

Community Treasure Hunt

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

Start Hunting!