# No solution found when solving 3 non linear equations

1 view (last 30 days)
Manqoba Mazibuko on 21 Jan 2020
Commented: Walter Roberson on 28 Jan 2020
Good day every one
I have been trying to sove 3 non linear equations but i am "No solution found" report.
The code is as follows
I defined a function containing the 3 non linear equations in an mfile called "angle"
function F=myfunction(x)
F(1)=cos(-x(1)+x(2))+cos(-x(1)+x(3));
F(2)=cos(-x(2)+x(1))+cos(-x(2)+x(3));
F(3)=cos(-x(3)+x(1))+cos(-x(3)+x(2));
After running code
I get the following report
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.
<stopping criteria details>
-60.5208
-62.8602
-61.6905
fsolve stopped because the sum of squared function values, r, has gradient with
relative norm 7.341307e-07; this is less than options.OptimalityTolerance = 1.000000e-06.
However, r = 7.954251e-01, exceeds sqrt(options.FunctionTolerance) = 1.000000e-03.
Optimization Metric Options
norm(grad r) = 7.34e-07 OptimalityTolerance = 1e-06 (default)
r = 7.95e-01 sqrt(FunctionTolerance) = 1.0e-03 (default)
Manqoba Mazibuko on 21 Jan 2020
Thank you I just did that. They are inconsistent. Thank you for the help, really appreciate it!!!

Matt J on 21 Jan 2020
Edited: Matt J on 21 Jan 2020
A numerical sweep also gives evidence that there is no solution
[x1,x2,x3]=ndgrid(linspace(-pi,+pi,512));
F1=cos(-x1+x2)+cos(-x1+x3);
F2=cos(-x2+x1)+cos(-x2+x3);
F3=cos(-x3+x1)+cos(-x3+x2);
F=[abs(F1(:)), abs(F2(:)), abs(F3(:))];
Fmin = min(sum(F,2))
Fmin =
1.0142

Alex Sha on 28 Jan 2020
Edited: Alex Sha on 28 Jan 2020
Hi, all, how about the solutions below, from the numerical perspective：
1：
x1: -5.21219473201765E21
x2: -0.279500437676178
x3: 1.29129588911872
Fevl:
f1=0
f2=-1.4930819167841E-15
f3=-1.4930819167841E-15
2:
x1: -1.79664678356017E21
x2: 2.02595283616513
x3: 3.59674916296003
Fevl:
f1=0
f2=-3.04739415125932E-15
f3=-3.04739415125932E-15
3:
x1: 2.19768008763813
x2: 5.41140930100612E22
x3: 0.626883760843237
Fevl:
f1=3.61394399649162E-15
f2=0
f3=3.61394399649162E-15
##### 2 CommentsShowHide 1 older comment
Walter Roberson on 28 Jan 2020
With that range of values, some of your x are within eps() of the others and so the additions lose precision.