3 Equations with 3 unknowns
Show older comments
Hi, I am trying to run 3 equations with 3 unknowns simultaneously. The three equations come from the partial derivatives of the origin equation. Each partial derivative is set to zero (See code below). When I run it, I get a 0X1 sym. If someone could please point me in the right direction that would be great. Thank you.
syms x y z
f = (-8+2*x^3-3*y+7*y^2+4*y^3+2*x^2*(-5+2*y)+x*(16+y+2*y^2))/(y*(-1+x+y))+z*(2+(1+2*y+x^2-y^2)^(1/2));
dx = diff(f,x)
dy = diff(f,y)
dz = diff(f,z)
sol = solve([dx==0,dy==0,dz==0],[x,y,z]);
1 Comment
Rik
on 17 Feb 2017
I can't see any problem with the code, so my question is how sure you are that there actually is a solution
Answers (1)
John D'Errico
on 17 Feb 2017
On a problem like this, there is almost certainly NO analytical solution. The system will effectively reduce to something equivalent to a quite high order polynomial if you could eliminate two of the variables, and a polynomial of order greater than 4 will generally have no analytical solution.
Wanting the impossible to be produced is unlikely to succeed. While you could try vpasolve, it also produces an empty result. (I tried it on your problem.)
It appears you are trying to solve for a minimum or maximum of the original function. So, one solution is just to see IF a minimum exists, using a numerical solver.
f = @(xyz) (-8+2*xyz(1)^3-3*xyz(2)+7*xyz(2)^2+4*xyz(2)^3+2*xyz(1)^2*(-5+2*xyz(2))+xyz(1)*(16+xyz(2)+2*xyz(2)^2))/(xyz(2)*(-1+xyz(1)+xyz(2)))+xyz(3)*(2+(1+2*xyz(2)+xyz(1)^2-xyz(2)^2)^(1/2));
fminsearch(f,[1 2 3])
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: -5699766121748715427873748759239973401620695364881719181816841967213981940140433606099394949372012591579136.000000
ans =
3.5522e+52 3.0955e+52 -3.2712e+53
Hmm. f seems to be unbounded from below. Is it bounded from above? Is there a maximum?
fminsearch(@(x) -f(x),[1 2 3])
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: -Inf
ans =
-1.6521 2.6521 14.562
So f is unbounded. Which seems to explain why even vpasolve failed to find a solution. That does not let us conclude that no stationary point exists however, but the failure of the symbolic tools tends to agree with that conclusion.
My suggestion is that you revisit your function. Very likely there may be a problem in your underlying assumptions. Either (1) the function is wrong, (2) or a stationary point may not exist, (3) or one does exist that is very well hidden. I think the answer lies in case 1 or 2 from those alternatives.
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!