• 28. 面積方程式:
• A = WL+(1/2)(W/2)^2
• 可以求得 L:
• L = (A −W^2/8)/W
• 周長為:
• P = 2L +W + 2((W/2)^2 + (W/2)^2)^0.5 = 2L +W + 2 W/(2^0.5)
• 程式:
• W = 6;A = 80;
• L = (A - W^2/8)/W
• P = 2*L + W + 2*W/sqrt(2)
• 解答為 L = 12.58 meters且周圍總長 P = 39.65 meters.
• 29. 針對兩三角形使用餘弦定律
• a^2 = b1^2 + c1^2 - 2b1c1 cos A1
• a2 = b2^2 + c2^2 − 2b2c2 cos A2
• 由已知第一列方程式可求解a, 然後再求解第二列方程式c2.
第二列方程式為c2的二次多項式方程式:
• c2^2 − (2b2 cos A2)c2 + b2^2 − a2 = 0
• 程式:
• b1 = 180;b2 = 165;c1 = 115;A1 = 120*pi/180;A2 = 100*pi/180;
• a = sqrt(b1^2 + c1^2 - 2*b1*c1*cos(A1));
• roots([1,-2*b2*cos(A2),b2^2-a^2])
• 兩根c2 = −228和c2 = 171. 取正根c2 = 171 公尺。
• 30. 面積式子:
• A = 2RL + (1/2)R
2• 由上式求解L:
• L = (A − R
2/2)/2R
• 價格為:
• C = 30(2R + 2L) + 40R
• 程式如下,須多次猜x的範圍,以獲得最小價格值。
• clear
• A = 1600;k = 0;
• for x = 5:0.01:30
• k = k + 1;
• R(k) = x;
• L(k) = (A - 0.5*pi*x^2)/(2*x);
• C(k) = 30*(2*x + 2*L(k)) + 40*pi*x;
• end
• plot(R,C,R,20*L),xlabel(0Radius (ft)0),ylabel(0Cost ($)0),...
• [rmin,costmin] = ginput(1)
• Lmin = (A - 0.5*pi*rmin^2)/(2*rmin)
• r1 = 0.8*rmin;r2 = 1.2*rmin;
• L1 = (A - 0.5*pi*r1^2)/(2*r1);
• L2 = (A - 0.5*pi*r2^2)/(2*r2);
• cost1 = 30*(2*r1 + 2*L1) + 40*pi*r1
• cost2 = 30*(2*r2+2*L2) + 40*pi*r2
• The figure shows the plot. Using the cursor to select the minimum point on the curve, we obtain the
optimum value of the radius R to be rmin = 18.59 feet,
and the corresponding cost is costmin = $5140. The
corresponding length L is Lmin = 28.4 feet. The costs
corresponding to a ±20% change from r = 18.59 are
cost1 = $5288 (a 3% increase) and cost2 = $5243 (a
2% increase). So near the optimum radius, the cost is
rather insensitive to changes in the radius.
• 37. 程式:
• k = 0;
• for x = -2:.01:6
• k = k + 1;
• if x < -1
• y(k) = exp(x+1);
• elseif x < 5
• y(k) = 2 + cos(pi*x);
• else
• y(k) = 10*(x-5) + 1;
• end
• end
• x = [-2:.01:6];
• plot(x,y),xlabel(‘Time x (s)’),ylabel(‘Height y (km)’)
• 圖示: