数值分析作业 - 数据拟合与最小二乘
Problem 1
1 | data = {{0, 0}, {1/6, 2}, {1/3, 0}, {1/2, -1}, {2/3, 1}, {5/6, 1}}; |
拟合结果:
1 | {c1 -> 0.5, c2 -> 0.666667, c3 -> 5.59057*10^-17} |
直观看来拟合的效果并不好.
Problem 2
法线方程
QR 分解
误差:
Problem 3

1 | x = N[Range[2, 4, 1/20]]; |
Mathematica 给出了结果矩阵条件数大的警告, 结果误差很大:
1 | {-254.73969572312623, 599.4456193346913, -509.47962931201255, |
1 | {q, r} = QRDecomposition[a]; |
Mathematica 给出了结果矩阵条件数大的警告, 但从结果看误差比法线方程小
1 | {0.9929717426864622, 1.0281267330856911, 0.9494600502108924, |

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
Permalink: https://duanyll.com/2023/05/15/Numeric-8/