Unknown variables appearing in solutions for symbolic equation solver

6 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Torsten
Torsten am 18 Jun. 2024
Bearbeitet: Torsten am 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.
  1 Kommentar
Tim
Tim am 19 Jun. 2024
Using vpa seems to have solved the issue. 'z' no longer appears in thhe roots. Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Aquatris
Aquatris am 18 Jun. 2024
Bearbeitet: Aquatris am 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 = 
  1 Kommentar
Tim
Tim am 18 Jun. 2024
Thank you for your response!
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.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by