why can matlab NOT solve this simple equation (2015a version) ?

조회 수: 2 (최근 30일)
Liqun
Liqun 2015년 8월 12일
답변: Walter Roberson 2015년 8월 13일
>> syms x;
>> solve(2*x-1==0)
ans =
1/2
>> solve(5000*(1/x - 1/(x*(1+x)^15)) - 35000 == 0)
>> solve(5000*(1/x - 1/(x*(1+x)^15)) - 35000 == 0, 'real', true)
There is a solution: 0.114913
what is wrong here?

답변 (2개)

Star Strider
Star Strider 2015년 8월 12일
Nothing is wrong. Your equation has 15 solutions, only one of which is real.
Use vpasolve, and to get the one real solution, select it as having no imaginary component:
x1 = vpasolve(5000*(1/x - 1/(x*(1+x)^15)) - 35000 == 0);
real_x1 = x1(imag(x1)==0)
real_x1 =
0.11491336334766181651570218695387

Walter Roberson
Walter Roberson 2015년 8월 13일
Notice the warning messages about parameterized solutions and ReturnConditions. Then it warns you that the answer that follows is subject to a particular condition.
The way to interpret what you received is that solve() is replying that "all x that meet a particular condition are solutions, and if you were to request that the conditions be output you could capture the condition for further manipulation"
If you wanted the numeric value you could vpa() or double() the result. There is no nice closed-form solution for the result. 15 degree polynomials seldom have nice closed-form solutions.

Community Treasure Hunt

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

Start Hunting!

Translated by