diff --git a/src/12/c12/SecondOrderDifference.cpp b/src/12/c12/SecondOrderDifference.cpp new file mode 100644 index 0000000..5f0da6b --- /dev/null +++ b/src/12/c12/SecondOrderDifference.cpp @@ -0,0 +1,5 @@ + + +int main(){ + +} \ No newline at end of file diff --git a/src/12/c12/func.py b/src/12/c12/func.py new file mode 100644 index 0000000..0a9b86e --- /dev/null +++ b/src/12/c12/func.py @@ -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}") diff --git a/src/12/c12/nums.txt b/src/12/c12/nums.txt new file mode 100644 index 0000000..05b55ae --- /dev/null +++ b/src/12/c12/nums.txt @@ -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 \ No newline at end of file diff --git a/src/12/c12/test.py b/src/12/c12/test.py new file mode 100644 index 0000000..e69de29 diff --git a/src/12/c13/c13_t1.cpp b/src/12/c13/c13_t1.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/12/c13/c13_t1.png b/src/12/c13/c13_t1.png new file mode 100644 index 0000000..6a40a8b Binary files /dev/null and b/src/12/c13/c13_t1.png differ