update
This commit is contained in:
parent
4cb35a1835
commit
da1f4df9fa
5
src/12/c12/SecondOrderDifference.cpp
Normal file
5
src/12/c12/SecondOrderDifference.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
}
|
38
src/12/c12/func.py
Normal file
38
src/12/c12/func.py
Normal file
@ -0,0 +1,38 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# 给定的数列
|
||||
sequence = [33, -66, 99, -33, 0, 0, 66, -33, 33, 33, -33, 33, 0, 53, -27, 27, 46, -33,
|
||||
366, -933, 966, -333, 66, 0, 0, 33, 66, -66, 66, 33, -33, 66, 33, 0, 0, 66]
|
||||
|
||||
# 计算相邻数值的差分
|
||||
diff = np.diff(sequence)
|
||||
|
||||
# 输出差分
|
||||
print("原数列的差分:", diff)
|
||||
|
||||
# 绘制原数列和差分图
|
||||
plt.figure(figsize=(10, 5))
|
||||
|
||||
# 原数列的图像
|
||||
plt.subplot(1, 2, 1)
|
||||
plt.plot(sequence, label="原数列")
|
||||
plt.title("原数列")
|
||||
plt.xlabel("索引")
|
||||
plt.ylabel("值")
|
||||
|
||||
# 差分图像
|
||||
plt.subplot(1, 2, 2)
|
||||
plt.plot(diff, label="差分", color='orange')
|
||||
plt.title("差分图")
|
||||
plt.xlabel("索引")
|
||||
plt.ylabel("差值")
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
# 计算数列的其他统计量
|
||||
mean = np.mean(sequence)
|
||||
std = np.std(sequence)
|
||||
print(f"数列的均值: {mean}")
|
||||
print(f"数列的标准差: {std}")
|
39
src/12/c12/nums.txt
Normal file
39
src/12/c12/nums.txt
Normal file
@ -0,0 +1,39 @@
|
||||
2 99
|
||||
3 264
|
||||
4 528
|
||||
5 924
|
||||
6 1386
|
||||
7 2013
|
||||
8 2772
|
||||
9 3663
|
||||
10 4686
|
||||
11 5907
|
||||
12 7293
|
||||
13 8877
|
||||
14 10692
|
||||
15 12705
|
||||
16 14949
|
||||
17 17424
|
||||
18 20183
|
||||
19 23199
|
||||
20 26499
|
||||
21 30129
|
||||
22 34056
|
||||
23 38646
|
||||
24 42966
|
||||
25 47982
|
||||
26 53361
|
||||
27 59169
|
||||
28 65406
|
||||
29 72072
|
||||
30 79200
|
||||
31 86856
|
||||
32 94974
|
||||
33 103620
|
||||
34 112827
|
||||
35 122562
|
||||
36 132891
|
||||
37 143847
|
||||
38 155430
|
||||
39 167640
|
||||
40 180543
|
0
src/12/c12/test.py
Normal file
0
src/12/c12/test.py
Normal file
0
src/12/c13/c13_t1.cpp
Normal file
0
src/12/c13/c13_t1.cpp
Normal file
BIN
src/12/c13/c13_t1.png
Normal file
BIN
src/12/c13/c13_t1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 483 KiB |
Loading…
Reference in New Issue
Block a user