필터 지우기
필터 지우기

Unknown variables appearing in solutions for symbolic equation solver

조회 수: 2 (최근 30일)
Tim
Tim 2024년 6월 18일
댓글: Tim 2024년 6월 19일
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
Torsten 2024년 6월 18일
편집: Torsten 2024년 6월 18일
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
Tim
Tim 2024년 6월 19일
Using vpa seems to have solved the issue. 'z' no longer appears in thhe roots. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Aquatris
Aquatris 2024년 6월 18일
편집: Aquatris 2024년 6월 18일
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
Tim
Tim 2024년 6월 18일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by