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

3 visualizaciones (últimos 30 días)
Liqun
Liqun el 12 de Ag. de 2015
Respondida: Walter Roberson el 13 de Ag. de 2015
>> 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?

Respuestas (2)

Star Strider
Star Strider el 12 de Ag. de 2015
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 el 13 de Ag. de 2015
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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by