How I can Solve an Advanced Cubic Equation

12 views (last 30 days)
I am aiming to solve the following cubic equation for x.
x^3*a^2(r-1)+x^2*a*(a-2*(r-1)) - x*(2a+1)+1 = 0
Essentially, I would like to express x as a function of the variable r and a. Any pointer as of how I shouldt ackle this problem. Thanks
  2 Comments
Walter Roberson
Walter Roberson on 23 Jan 2020
Symbolic Toolbox solve() with 'MaxDegree', 3 option and simplify() afterwards.
Complete answers exist, but it is normal for the output to be what appears to be a moderately long string of nonsense.
J. Alex Lee
J. Alex Lee on 24 Jan 2020
Why not just start with Wikipedia or textbooks on solution of cubics? It's usually easier to do that than to decipher/simplify the results of symbolic solvers (at least my experience with Mathematica; I've never use TMW's symbolic toolbox)

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 24 Jan 2020
syms x a r
eqn = x^3*a^2*(r-1)+x^2*a*(a-2*(r-1)) - x*(2*a+1)+1;
sol = simplify(solve(eqn, x, 'maxdegree', 3));
The second and third solution are over 1000 characters each. I don't think the solution will have any meaning to you.

Community Treasure Hunt

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

Start Hunting!