# MATLAB: I can’t solve this nonlinear equation

nonlinear

syms V_1 V_2 V_3 f_1 f_2 f_3 Re_1 Re_2 Re_3
f1=1+((f_2)*6/0.015+24.7)*(V_2)^(2)/(2*9.81)-((f_3)*1/0.015+26.9)*(V_3)^(2)/(2*9.81);
f2=-Re_1+(V_1)*0.015*10^(6)/1.002;
f3=-Re_2+(V_2)*0.015*10^(6)/1.002;
f4=-Re_3+(V_3)*0.015*10^(6)/1.002;
f8=-(V_1)^(2)+(V_2)^(2)+(V_3)^(2);
f5=-1/sqrt(f_1)-2*log10(1.5*10^(-6)/(0.015*3.7)+2.51/((Re_1)*sqrt(f_1)));
f6=-1/sqrt(f_2)-2*log10(1.5*10^(-6)/(0.015*3.7)+2.51/((Re_2)*sqrt(f_2)));
f7=-1/sqrt(f_3)-2*log10(1.5*10^(-6)/(0.015*3.7)+2.51/((Re_3)*sqrt(f_3)));
[V_1,V_2,V_3,f_1,f_2,f_3,Re_1,Re_2,Re_3]=solve('f1','f2','f3','f4','f5','f6','f7','f8');

You have too many equations, too few unknowns. 8 equations, with 9 unknowns. This is often called an under-determined problem.
To be specific, looking at the equations, we have f2, f3, and f4 are not that important. They simply tell me that Re_1 is a simple multiple of V_1, the same applies to Re_2 as a multiple of V_2, and Re_3 as a multiple of V_3.
If you know the V's then you know the corresponding value for Re also. All they do is make the other equations look a little simpler, because those values Re_n each only appear in one other equation. Effectively, this means you could substitute V_1 for Re_1 trivially in the one equation where Re_1 appears. Do the same for Re_2 and Re_3.
What else? The values V_1, V_2, V_3 appear to be the legs of a right triangle, or can be viewed as such, with V_1 the length of the hypotenuse. That does not seem to be particularly relevant to anything though.
In the end though, you have a system of 5 nonlinear equations in 6 unknowns. Then you could just compute the values of Re_n directly from V_n. That the unknowns f_1, f_2, f_3 appear inside and outside of a log
``pretty(f5)                 /         251            1   \              log| ------------------ + ----- | 2      1          \ 100 Re_1 sqrt(f_1)   37000 /- --------- - -----------------------------------  sqrt(f_1)                 log(10)``
tells me that unless you are able to provide a 6th useful piece of information (another equation) AND you get very lucky and the solver is able to use a tool like the wrightOmega, this mess will still be too nonlinear to find an analytical solution.
Note that IF you do manage to come up with an independent additional equation, then you could try to use a tool like vpasolve or fsolve. These are numerical rootfinding utilities. However, you should also know there will often be multiple solutions to such a problem. That means the solution you will find will be dependent on the starting values you provide to the solver.
If you do not manage to find a 6th INDEPENDENT equation, then at best there will be infinitely many solutinos possible (if any exist at all.) In that case, you could pick any of the unknowns and set it to your favorite number. Then you could in theory solve for the other unknowns, parametrically as a function of the parameter you chose to fix at some value. Again, you would not find an analytical solution, and there will still be likely more than one solution possible.
Edit: Let me make it simpler. Suppose I posed the very simple problem
x + y = 1
What is "the" solution? Can you solve the problem? Sort of, yes, and no.
The solution locus is the INFINITE set of points that lie along the line defined by x+y=1. Here the locus lies along a straight line. We could plot it, by recognizing that IF we knew x, then we could compute y as 1-x. Thus for ANY value of the parameter x, we now can find y. A solution will then exist, defined parametrically on the value of x. I might call the solution locus a 1-manifold, a curve that lies in the (x,y) plane.
Now, suppose we add an additional equation, and an additional unknown variable? So 2 equations, with 3 unknowns.
x + y = 1
x^2 + y^2 + z^2 = 4
You might recognize the new equation as the equation of the surface of a sphere with radius 4. Can we solve this problem? Well, again, yes and no. In three dimensions, the equation
x + y + 0*z = 1
is the equation of a plane. We already said the second equation is that of the surface of a sphere of radius 2. So the solution, IF any solution exists, will be the intersection of that plane with the sphere, which is a circle. The solution set is now again a 1-manifold of solutions, but this time the manifold is a curved line that happens to be a closed circle, embedded in the R^3 space of your unknowns.
That is, the solution locus to this under-determined problem is now the infinite set of points that lie on a specific circle floating at an inclined angle in 3 dimensions. There is no unique solution, but an infinite set of solutions.
What could you do? Well, you could pick ANY value for any one of the parameters, x, y, or z. Depending on that value, you will now find either 0, 1, or 2 solutions.
For example, what happens when z == 3? Then the sphere equation will have no real solutions for x and y, since it would reduce to
x^2 + y^2 = 4 - 9 = -5
For other values of z, we will find 1 or 2 specific solutions, that now depend on the value of z. In MATLAB, we might do this as:
``syms x y z>> sol = solve(x + y == 1,x^2 + y^2 + z^2 == 4,x,y)sol =   struct with fields:    x: [2×1 sym]    y: [2×1 sym]    >> sol.xans = (7 - 2*z^2)^(1/2)/2 + 1/2 1/2 - (7 - 2*z^2)^(1/2)/2 >> sol.yans = 1/2 - (7 - 2*z^2)^(1/2)/2 (7 - 2*z^2)^(1/2)/2 + 1/2``
So you can see I have now found the solution(s), parametrically as a function of z. When will a real solution(s) exist? It turns out to be easy from here, because that seems to depend on a discriminant:
7 - 2*z^2
That is, when 7-2*z^2 is less than zero, no real solutions exist. When 7-2*z^2 == 0, we get a unique solution, sort of a double root, but only one solution. And when that number is positive, then we get 2 distinct solutions. We can think of them as
x = 1/2 +/- sqrt(7 - z^2)/2
y = 1/2 -/+ sqrt(7 - z^2)/2
Can we then extend this sort of understanding to your problem? You have 5 equations, but 6 unknowns. The same applies, except that I would wager some money that no analytical solution will arise. So a 1-manifold of solutions MAY exist, as some strange looking thing, a 1-dimensional curve floating in a 6 dimensional space.
As I said, at best you can pick one variable, fix it to some value, and then try to find the set of all solutions to the problem. There may be multiple solutions.