how can i solve this problem?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
syms x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10;
eq1=y1*(30*x2 + 40*x3 + 50*x4 + 60*x5 + 70*x6 + 30*x7 + 40*x8 + 50*x9 + 60*x10)-550;
eq2=y2*(50*x1 + 40*x3 + 50*x4 + 30*x5 + 50*x6 + 40*x7 + 50*x8 + 60*x9 + 30*x10)-600;
eq3=y3*(50*x1 + 30*x2 + 60*x4 + 20*x5 + 50*x6 + 40*x7 + 50*x8 + 40*x9 + 20*x10)-500;
eq4=y4*(50*x1 + 40*x2 + 80*x3 + 50*x5 + 60*x6 + 50*x7 + 30*x8 + 40*x9 + 50*x10)-600;
eq5=y5*(30*x1 + 50*x2 + 50*x3 + 60*x4 + 60*x6 + 50*x7 + 30*x8 + 30*x9 + 60*x10)-700;
eq6=y6*(40*x1 + 50*x2 + 50*x3 + 50*x4 + 40*x5 + 60*x7 + 40*x8 + 50*x9 + 70*x10)-700;
eq7=y7*(40*x1 + 50*x2 + 40*x3 + 50*x4 + 30*x5 + 80*x6 + 40*x8 + 50*x9 + 30*x10)-600;
eq8=y8*(30*x1 + 30*x2 + 40*x3 + 40*x4 + 20*x5 + 30*x6 + 90*x7 + 40*x9 + 30*x10)-500;
eq9=y9*(50*x1 + 40*x2 + 80*x3 + 40*x4 + 20*x5 + 30*x6 + 30*x7 + 40*x8 + 40*x10)-550;
eq10=y10*(50*x1 + 40*x2 + 40*x3 + 30*x4 + 50*x5 + 40*x6 + 20*x7 + 50*x8 + 30*x9)-600;
eq11=x1*(30*y2 + 40*y3 + 50*y4 + 60*y5 + 70*y6 + 30*y7 + 40*y8 + 50*y9 + 60*y10)-600;
eq12=x2*(50*y1 + 40*y3 + 50*y4 + 30*y5 + 50*y6 + 40*y7 + 50*y8 + 60*y9 + 30*y10)-700;
eq13=x3*(50*y1 + 30*y2 + 60*y4 + 20*y5 + 50*y6 + 40*y7 + 50*y8 + 40*y9 + 20*y10)-600;
eq14=x4*(50*y1 + 40*y2 + 80*y3 + 50*y5 + 60*y6 + 50*y7 + 30*y8 + 40*y9 + 50*y10)-700;
eq15=x5*(30*y1 + 50*y2 + 50*y3 + 60*y4 + 60*y6 + 50*y7 + 30*y8 + 30*y9 + 60*y10)-500;
eq16=x6*(40*y1 + 50*y2 + 50*y3 + 50*y4 + 40*y5 + 60*y7 + 40*y8 + 50*y9 + 70*y10)-700;
eq17=x7*(40*y1 + 50*y2 + 40*y3 + 50*y4 + 30*y5 + 80*y6 + 40*y8 + 50*y9 + 30*y10)-550;
eq18=x8*(30*y1 + 30*y2 + 40*y3 + 40*y4 + 20*y5 + 30*y6 + 90*y7 + 40*y9 + 30*y10)-500;
eq19=x9*(50*y1 + 40*y2 + 80*y3 + 40*y4 + 20*y5 + 30*y6 + 30*y7 + 40*y8 + 40*y10)-600;
eq20=x10*(50*y1 + 40*y2 + 40*y3 + 30*y4 + 50*y5 + 40*y6 + 20*y7 + 50*y8 + 30*y9)-600;
eqs=[eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, eq11, eq12, eq13, eq14, eq15, eq16, eq17, eq18, eq19, eq20];
[x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8,x9,y9,x10,y10]=vpasolve(eqs,[x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8,x9,y9,x10,y10]);
0 comentarios
Respuestas (1)
John D'Errico
el 23 de Dic. de 2021
You have 20 nonlinear equations in 20 unknowns. Do you seriously expect a symbolic solution? And of course, there will very possibly be many equally valid solutions, at least if any exist at all.
Even a numerical solution, as vpasolve would try to produce is going to take a significant amount of time. So why would you try to formulate this as s symbolic problem at all? If this has a hope of any solution in a reasonable amount of time, it would be using a numerical solver like fsolve. Could you try this?
opts = optimset('fsolve');
opts.MaxIterations = 10000;
xy = fsolve(@myfun,(2+rand(1,20)),opts)
myfun(xy)
I'll try it a second time, with a different random start point.
xy = fsolve(@myfun,(2+rand(1,20)),opts)
myfun(xy)
So no solution was found. That does not mean a solution does not exist. But it does tell me what I expect, that there will be many multiple local stable points for the solver, and that if you will hope to find a solution, that would require a great deal of luck to have chosen good starting values.
But worse, see that despite trying different starting values, AND arriving at clearly differnt points for xy, in both cases, the values for myfun were close to identical. Does that tell me anything? YES> That suggests there may be no exact solution at all.
Would vpasolve do any better? Surely not, as you are asking this question in the first place. vpasolve requires a starting point. And the solution will be dependent on the start point, just like fsolve. But worse, vpasolve will not roduce an answer if an exact one does not exist. At least fsolve returns an answer. And vpasolve will take one hell of a long time to converge for this large of a problem.
All of that means there is likely no exact solution possible, even one that is close to exact.
function Z = myfun(XY)
Z = [XY(11)*(30*XY(2) + 40*XY(3) + 50*XY(4) + 60*XY(5) + 70*XY(6) + 30*XY(7) + 40*XY(8) + 50*XY(9) + 60*XY(10))-550;
XY(12)*(50*XY(1) + 40*XY(3) + 50*XY(4) + 30*XY(5) + 50*XY(6) + 40*XY(7) + 50*XY(8) + 60*XY(9) + 30*XY(10))-600;
XY(13)*(50*XY(1) + 30*XY(2) + 60*XY(4) + 20*XY(5) + 50*XY(6) + 40*XY(7) + 50*XY(8) + 40*XY(9) + 20*XY(10))-500;
XY(14)*(50*XY(1) + 40*XY(2) + 80*XY(3) + 50*XY(5) + 60*XY(6) + 50*XY(7) + 30*XY(8) + 40*XY(9) + 50*XY(10))-600;
XY(15)*(30*XY(1) + 50*XY(2) + 50*XY(3) + 60*XY(4) + 60*XY(6) + 50*XY(7) + 30*XY(8) + 30*XY(9) + 60*XY(10))-700;
XY(16)*(40*XY(1) + 50*XY(2) + 50*XY(3) + 50*XY(4) + 40*XY(5) + 60*XY(7) + 40*XY(8) + 50*XY(9) + 70*XY(10))-700;
XY(17)*(40*XY(1) + 50*XY(2) + 40*XY(3) + 50*XY(4) + 30*XY(5) + 80*XY(6) + 40*XY(8) + 50*XY(9) + 30*XY(10))-600;
XY(18)*(30*XY(1) + 30*XY(2) + 40*XY(3) + 40*XY(4) + 20*XY(5) + 30*XY(6) + 90*XY(7) + 40*XY(9) + 30*XY(10))-500;
XY(19)*(50*XY(1) + 40*XY(2) + 80*XY(3) + 40*XY(4) + 20*XY(5) + 30*XY(6) + 30*XY(7) + 40*XY(8) + 40*XY(10))-550;
XY(20)*(50*XY(1) + 40*XY(2) + 40*XY(3) + 30*XY(4) + 50*XY(5) + 40*XY(6) + 20*XY(7) + 50*XY(8) + 30*XY(9))-600;
XY(1)*(30*XY(12) + 40*XY(13) + 50*XY(14) + 60*XY(15) + 70*XY(16) + 30*XY(17) + 40*XY(18) + 50*XY(19) + 60*XY(20))-600;
XY(2)*(50*XY(11) + 40*XY(13) + 50*XY(14) + 30*XY(15) + 50*XY(16) + 40*XY(17) + 50*XY(18) + 60*XY(19) + 30*XY(20))-700;
XY(3)*(50*XY(11) + 30*XY(12) + 60*XY(14) + 20*XY(15) + 50*XY(16) + 40*XY(17) + 50*XY(18) + 40*XY(19) + 20*XY(20))-600;
XY(4)*(50*XY(11) + 40*XY(12) + 80*XY(13) + 50*XY(15) + 60*XY(16) + 50*XY(17) + 30*XY(18) + 40*XY(19) + 50*XY(20))-700;
XY(5)*(30*XY(11) + 50*XY(12) + 50*XY(13) + 60*XY(14) + 60*XY(16) + 50*XY(17) + 30*XY(18) + 30*XY(19) + 60*XY(20))-500;
XY(6)*(40*XY(11) + 50*XY(12) + 50*XY(13) + 50*XY(14) + 40*XY(15) + 60*XY(17) + 40*XY(18) + 50*XY(19) + 70*XY(20))-700;
XY(7)*(40*XY(11) + 50*XY(12) + 40*XY(13) + 50*XY(14) + 30*XY(15) + 80*XY(16) + 40*XY(18) + 50*XY(19) + 30*XY(20))-550;
XY(8)*(30*XY(11) + 30*XY(12) + 40*XY(13) + 40*XY(14) + 20*XY(15) + 30*XY(16) + 90*XY(17) + 40*XY(19) + 30*XY(20))-500;
XY(9)*(50*XY(11) + 40*XY(12) + 80*XY(13) + 40*XY(14) + 20*XY(15) + 30*XY(16) + 30*XY(17) + 40*XY(18) + 40*XY(20))-600;
XY(10)*(50*XY(11) + 40*XY(12) + 40*XY(13) + 30*XY(14) + 50*XY(15) + 40*XY(16) + 20*XY(17) + 50*XY(18) + 30*XY(19))-600];
end
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!