※ 引述《alfadick (悟道修行者)》之銘言:
: 問 |x-1| + 2|x-2| + 3|x-3| + ... + 10|x-10| 有最小值時 x 為何?
S = |x-1| + 2|x-2| + 3|x-3| + ... + 10|x-10|
Assume k <= x <= k+1
then
S = (x-1)+...+k(x-k)+(k+1)(k+1-x)+...+10(10-x)
= ax+b
where a = (1+2+...+k) - [(k+1)+(k+2)+...10]
= -(1+2+...+10) + 2(1+2+...+k)
= k^2 + k -55
b = -(1+2^2+...+k^2) + [(k+1)^2+...+10^2]
= (1+2^2+...+10^2) - 2(1+2^2+...+k^2)
= 385 - k(k+1)(2k+1)/3
(i) a < 0 iff k <=6, then min S occurs at x = k+1
min S = (k+1)(k^2+k-55) + 385 -k(k+1)(2k+1)/3
3 min S = k^3+3*k^2-163*k+990 = f(k)
f'(k) = 3k^2 + 6k -163
f'(k) = 0 at k~-8.44,+6.44
hence, 3 min S = f(6) = 336, min S = 112 at x=k+1=7
(ii) a > 0 iff k >= 7, then min S occurs at x = k
min S = k(k^2+k-55) + 385 -k(k+1)(2k+1)/3
3 min S = k^3 - 166k + 1155 = h(k)
h'(k) = 3k^2 - 166
h'(k) = 0 occurs at k~-7.44,+7.44
h(7) = 336, h(8) = 339, min S = 112 at x=k=7
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 27.147.57.77
※ 編輯: JohnMash 來自: 27.147.57.77 (09/07 10:44)