回答編集履歴

1

追記

2022/04/05 03:51

投稿

bsdfan
bsdfan

スコア4576

test CHANGED
@@ -2,7 +2,19 @@
2
2
  そこまで細かい形状を気にしなくていいならば、線形補間(numpy.interp)が簡単です。
3
3
 
4
4
  ```python
5
+ gain = 1.24
5
6
  x = np.linspace(0, 1, len(sample_list))
6
- new_list_07 = np.interp(x, x * 0.7, sample_list).astype(int)
7
+ new_list = np.interp(x, x * gain, sample_list).astype(int)
7
- new_list_13 = np.interp(x, x * 1.3, sample_list).astype(int)
8
8
  ```
9
+
10
+ ###### 追記
11
+
12
+ 累積和 → gain倍の線形補間 → 差分とやるのが、本来やりたいことに近いかもしれません。
13
+ ```python
14
+ gain = 1.24
15
+ x = np.linspace(0, 1, len(sample_list))
16
+ new_list = np.diff(
17
+ np.interp(x, x * gain, np.cumsum(sample_list)).astype(int),
18
+ prepend=0)
19
+ ```
20
+