Hey guys I want to solve this equation to rearrange for x but it's giving a message which is strange. Does anyone know what the problem is? I know that the solution is complex but it should still solve for it. I know that my syntax etc are correct. Would anyone know an alternate way to display complex roots?
syms x y
>> eqn = (x^2.5 - (1250*(1-(0.525*x^0.5))^2)/(y*(1-(0.3*x^0.5)))==0)
eqn =
x^(5/2) + (1250*((21*x^(1/2))/40 - 1)^2)/(y*((3*x^(1/2))/10 - 1)) == 0
>> v_x=solve(eqn,x)
Warning: The solutions are parametrized by the symbols:
z1 = ({0.0} union Dom::ImageSet(1.0*x*I + y, [x, y], [R_,Dom::Interval(0.0, RD_INF)]) union
Dom::ImageSet(1.0*x*I, x, Dom::Interval(0.0, RD_INF))) intersect RootOf(48*y*z^6 - 160*y*z^5 + 55125*z^2 -
210000*z + 200000, z)
> In solve at 190
v_x =
z1^2

 채택된 답변

John D'Errico
John D'Errico 2015년 4월 3일

1 개 추천

So you want to solve for x, given an unknown y? Why do you think an analytical solution exists, or even if it does, that it can be found?
First, get rid of those radicals. Substitute
x = u^2
simplify(subs(eqn,x,u^2))
ans =
48*y*u^6 + 55125*u^2 + 200000 == 80*(2*y*u^4 + 2625)*(u^2)^(½) & ~u in {-10/3, 10/3} & y ~= 0
So, subject to some constraints on y and u, this reduces to a 6th degree polynomial in u, where the coefficients are functions of y. While it is possible to solve some for the roots of SOME simple polynomials, they are relatively rare. This is surely not one of them. In general, such polynomials of degree 5 or higher are not solvable analytically.
If you choose to supply a value for y, then you could solve for the roots numerically, but that is as much as you can ask to do. Even there you will get only numerical values for those roots, and only if a root exists.
Having done that, now lets go back to your original equation, because the transformation may introduce spurious solutions. ezplot being the impressive tool that it is, we get:
ezplot(eqn,[0,10])
grid on
vpasolve(subs(eqn,y,5))
ans =
2.6155171172702278618796721666051
To solve for a point on the upper branch of that curve,
vpasolve(subs(eqn,y,5),5)
ans =
6.25

댓글 수: 4

sarah
sarah 2015년 4월 3일
Thanks for that. That's really helpful.
So there is no way of obtaining an analytical solution besides graphical? I was hoping to get equation in terms of x and hence substitute into a=b*x^0.5.
If not, I know the range of x from graphical solution so i could try working with that.
John D'Errico
John D'Errico 2015년 4월 3일
편집: John D'Errico 2015년 4월 3일
I am pretty confident there would be no solution that you can get from a formula. That does not make it impossible, just that we cannot get to it. As I pointed out, this reduces to what is fundamentally a 6th degree polynomial, and that was shown long ago to have no analytical solutions for general coefficients.
Still, there are always many ways to cole a problem. For example, for the lower branch of x as a function of y, do this...
ylist = logspace(-5,2,101);
xlist = nan(size(ylist));
for ii = 1:numel(ylist)
xlist(ii) = double(vpasolve(subs(eqn,y,ylist(ii)),1));
end
semilogx(ylist,xlist)
xlabel 'Y'
ylabel 'X'
grid on
Now, we can use a spline to interpolate that relationship, modeling it as x(log(y)).
spl_lower_branch = pchip(log10(ylist),xlist);
Now interpolation is simple, to interpolate any point off from that curve.
fnval(spl_lower_branch,log10(1.25))
ans =
3.02304946224984
(ppval would work too here.)
Thus, when y was 1.25, x is 3.023... on the lower branch.
You should be able to solve for the other branch by a careful choice of starting values.
ylist = logspace(-5,4,201);
xlist2 = nan(size(ylist));
for ii = 1:numel(ylist)
xlist2(ii) = double(vpasolve(subs(eqn,y,ylist(ii)),[3.626 12]));
end
[xlist2;ylist]
semilogx(ylist,xlist2)
grid on
Again, we can fit that with a spline as above and use it for interpolation for points off the upper branch of the curve.
spl_upper_branch = pchip(log10(ylist),xlist2);
fnval(spl_upper_branch,log10(1.25))
ans =
4.61207127135728
I might have chosen a nonlinear model to fit these curves. A bit of effort would give us something there if you dislike using splines.
sarah
sarah 2015년 4월 6일
thank you so much that was really helpful :))
sarah
sarah 2015년 4월 6일
I have another question for you regarding vpasolve for upper and lower branch. At times the graph would show two solutions but vpasolve for upper and lower branch gives the same answer. Would you know possibly why?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

질문:

2015년 4월 3일

댓글:

2015년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by