ans =
18/5/(x4^2+(y4-5)^2)^(1/2)*(2*y4-10)+36/5+18/5/((x4-15)^2+(y4-8)^2)^(1/2)*(2*y4-16) >>
[x4,y4]=solve('36/5/(x4^2+(y4-5)^2)^(1/2)*x4+18/5/((x4-15)^2+(y4-8)^2)^(1/2)*(2*x4-30)=0','18/5/(x4^2+(y4-5)^2)^(1/2)*(2*y4-10)+36/5+18/5/((x4-15)^2+(y4-8)^2)^(1/2)*(2*y4-16)=0') x4 =
15/2-3/2*3^(1/2) y4 =
13/2-5/2*3^(1/2)
>> x4=15/2-3/2*3^(1/2) x4 =
4.9019
>> y4=13/2-5/2*3^(1/2) y4 =
2.1699 >>
7.2*(x4^2+(y4-5)^2)^0.5+7.2*y4+7.2*((x4-15)^2+(y4-8)^2)^0.5+5*(21+7.2)
ans =
281.3307 %公司一的管线建设费用 >>
7.2*(x4^2+(y4-5)^2)^0.5+7.2*y4+7.2*((x4-15)^2+(y4-8)^2)^0.5+5*(24+7.2)
- 29 -
ans =
296.3307 %公司二的管线建设费用 >>
7.2*(x4^2+(y4-5)^2)^0.5+7.2*y4+7.2*((x4-15)^2+(y4-8)^2)^0.5+5*(20+7.2)
ans =
276.3307 %公司三的管线建设费用
问题三 方案三 公司一(21)
>> syms x y z f >>
f=5.6*(x^2+(y-5)^2)^0.5+7.2*y+6*((x-15)^2+(y-z)^2)^0.5+27*(25+(8-z)^2)^0.5 f =
28/5*(x^2+(y-5)^2)^(1/2)+36/5*y+6*((x-15)^2+(y-z)^2)^(1/2)+27*(25+(8-z)^2)^(1/2)
>> diff(f,'x') ans =
28/5/(x^2+(y-5)^2)^(1/2)*x+3/((x-15)^2+(y-z)^2)^(1/2)*(2*x-30)
>> diff(f,'y') ans =
14/5/(x^2+(y-5)^2)^(1/2)*(2*y-10)+36/5+3/((x-15)^2+(y-z)^2)^(1/2)*(2*y-2*z)
>> diff(f,'z') ans =
- 30 -
3/((x-15)^2+(y-z)^2)^(1/2)*(-2*y+2*z)+27/2/(25+(8-z)^2)^(1/2)*(-16+2*z) >>
[x,y,z]=solve('28/5/(x^2+(y-5)^2)^(1/2)*x+3/((x-15)^2+(y-z)^2)^(1/2)*(2*x-30)=0','14/5/(x^2+(y-5)^2)^(1/2)*(2*y-10)+36/5+3/((x-15)^2+(y-z)^2)^(1/2)*(2*y-2*z)=0','3/((x-15)^2+(y-z)^2)^(1/2)*(-2*y+2*z)+27/2/(25+(8-z)^2)^(1/2)*(-16+2*z)=0') x =
1/5169307935528*(-23931981183+26794465*47771^(1/2)+252947445*166991^(1/2))*166991^(1/2) y =
1375/216-520675/340511688*47771^(1/2)-520675/36070056*166991^(1/2) z =
8-1765/525481*47771^(1/2) >>
x=1/5169307935528*(-23931981183+26794465*47771^(1/2)+252947445*166991^(1/2))*166991^(1/2) x =
6.7424 >> y =1375/216-520675/340511688*47771^(1/2)-520675/36070056*166991^(1/2) y =
0.1327
- 31 -
>> z =8-1765/525481*47771^(1/2) z =
7.2659 >>
5.6*(x^2+(y-5)^2)^0.5+7.2*y+6*((x-15)^2+(y-z)^2)^0.5+27*(25+(8-z)^2)^0.5
ans =
249.4422
公司二(24)
>> syms x y z f >>
f=5.6*(x^2+(y-5)^2)^0.5+7.2*y+6*((x-15)^2+(y-z)^2)^0.5+30*(25+(8-z)^2)^0.5 f =
28/5*(x^2+(y-5)^2)^(1/2)+36/5*y+6*((x-15)^2+(y-z)^2)^(1/2)+30*(25+(8-z)^2)^(1/2)
>> diff(f,'x') ans =
28/5/(x^2+(y-5)^2)^(1/2)*x+3/((x-15)^2+(y-z)^2)^(1/2)*(2*x-30)
>> diff(f,'y') ans =
14/5/(x^2+(y-5)^2)^(1/2)*(2*y-10)+36/5+3/((x-15)^2+(y-z)^2)^(1/2)*(2*y-2*z)
>> diff(f,'z') ans =
- 32 -