# Unknown variables appearing in solutions for symbolic equation solver

1 view (last 30 days)
Tim on 18 Jun 2024
Commented: Tim on 19 Jun 2024
Hello,
I am currently trying to solve a symbolic equation for a variable and the solution I am receiving has roots of 'z' which was not previously defined or used in any of my equations. Here is where/how it appears:
In another case I modified the simplifcation process to attempt get a usable solution and ended up with just the variable 'u' which was not previously used or defined either. Is there a known reason why these variables are appearing. I've read that equations of the fifth degree can be hard to solve symbolically, which may be the reason for the 'z' in the roots but I don't quite understand the 'u' solution.

Torsten on 18 Jun 2024
Edited: Torsten on 18 Jun 2024
syms x
f = x^5+x^4+3*x^2-4;
solve(f==0)
ans =
vpa(solve(f==0))
ans =
double(solve(f==0))
ans =
0.9269 + 0.0000i -1.2264 + 0.0000i 0.4282 - 1.4411i 0.4282 + 1.4411i -1.5569 + 0.0000i
I have no explanation for the u that appears in your solution. Please include your code to reproduce the problem if it is not yet solved by the answer from above.
Tim on 19 Jun 2024
Using vpa seems to have solved the issue. 'z' no longer appears in thhe roots. Thank you!

Aquatris on 18 Jun 2024
Edited: Aquatris on 18 Jun 2024
This is shown in the documentation of solve, under Solve Polynomial Equations of High Degree.
You should call the function with 'MaxDegree' argument to get an explicit solution. Here is the example from the documentation
syms x a
eqn = x^3 + x^2 + a == 0;
solve(eqn, x)
ans =
S = solve(eqn, x, 'MaxDegree', 3)
S =
Tim on 18 Jun 2024
The roots I posted previously are the result of setting the 'MaxDegree' parameter to 4.
I have also tried setting assumptions for all the equations and simplifying to hopefully help the solving process.

### Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

R2024a

### Community Treasure Hunt

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

Start Hunting!