我一直在尋找一段時間到websearch,但是,可能或可能我錯過了正確的術語。正確的方法來獲得連續間隔的具體數組值的加權平均值
我有標量的任意大小的數組...
array = [n_0, n_1, n_2, ..., n_m]
我也有一個功能f->x->y
,具有0<=x<=1
,並y
從array
的插補值。例子:
array = [1,2,9]
f(0) = 1
f(0.5) = 2
f(1) = 9
f(0.75) = 5.5
我的問題是,我想計算的平均值爲一些區間r = [a..b]
,其中a E [0..1]
和b E [0..1]
,即我想概括我的插補功能f->x->y
計算平均沿r
。
我的頭腦讓我有些輕浮w.r.t.找到正確的權重。想象一下,我想計算f([0.2,0.8])
:
array --> 1 | 2 | 9
[0..1] --> 0.00 0.25 0.50 0.75 1.00
[0.2,0.8] --> ^___________________^
後者是值的範圍我想計算的平均值。
難道是數學上正確計算平均喜歡這個?:*
1 * (1-0.8) <- 0.2 'translated' to [0..0.25]
+ 2 * 1
avg = + 9 * 0.2 <- 0.8 'translated' to [0.75..1]
----------
1.4 <-- the sum of weights
寫了這個問題後,我得到了一些見解,我現在很確定我是正確的(但不是100%)。 –
好吧,我現在很確定我是正確的:http://en.wikipedia.org/wiki/Weighted_average#Mathematical_definition。我會寫一個答案:) –
我犯了交叉張貼:http://math.stackexchange.com/questions/528267/what-is-the-average-value-of-number-range-along-間隔。 –