我需要对包含'n'
自变量和因变量的数据执行线性插值。我目前scipy.interpolate.LinearNDInterpolator
用于执行插值。但是,当我通过将(变量的)所有值乘以常数来更改数据集的范围时,插值后的结果会完全改变。
让我用一个具体的例子来说明这一点:
X = [[0.00000000e+00, 1.00000000e+00], [0.00000000e+00, 8.00000000e+00], [0.00000000e+00, 1.60000000e+01], [0.00000000e+00, 3.20000000e+01],
[0.00000000e+00, 6.40000000e+01], [0.00000000e+00, 1.28000000e+02], [1.00000000e-06, 1.00000000e+00], [1.00000000e-06, 8.00000000e+00],
[1.00000000e-06, 1.60000000e+01], [1.00000000e-06, 3.20000000e+01], [1.00000000e-06, 6.40000000e+01], [1.00000000e-06, 1.28000000e+02],
[1.00000000e-06, 2.56000000e+02], [1.00000000e-06, 5.12000000e+02], [1.00000000e-05, 1.00000000e+00], [1.00000000e-05, 8.00000000e+00],
[1.00000000e-05, 1.60000000e+01], [1.00000000e-05, 3.20000000e+01], [1.00000000e-05, 6.40000000e+01], [1.00000000e-05, 1.28000000e+02],
[1.00000000e-05, 2.56000000e+02], [1.00000000e-05, 5.12000000e+02], [1.00000000e-04, 1.00000000e+00], [1.00000000e-04, 8.00000000e+00],
[1.00000000e-04, 1.60000000e+01], [1.00000000e-04, 3.20000000e+01], [1.00000000e-04, 6.40000000e+01], [1.00000000e-04, 1.28000000e+02],
[1.00000000e-04, 2.56000000e+02], [1.00000000e-04, 5.12000000e+02], [1.00000000e-03, 1.00000000e+00], [1.00000000e-03, 8.00000000e+00],
[1.00000000e-03, 1.60000000e+01], [1.00000000e-03, 3.20000000e+01], [1.00000000e-03, 6.40000000e+01], [1.00000000e-03, 1.28000000e+02],
[1.00000000e-02, 1.00000000e+00], [1.00000000e-02, 8.00000000e+00], [1.00000000e-02, 1.60000000e+01], [1.00000000e-02, 3.20000000e+01],
[1.00000000e-02, 6.40000000e+01], [1.00000000e-02, 1.28000000e+02]]
y = [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 6.99000000e-17, 5.60000000e-16, 1.12011400e-15, 2.24034300e-15,
4.48080000e-15, 7.56193140e-14, 2.17896343e-13, 5.02450401e-13, 6.99000000e-16, 5.60000000e-15, 1.12011430e-14, 2.24034290e-14, 4.48080000e-14, 8.96171430e-14,
1.79235429e-13, 3.58472001e-13, 6.99000000e-15, 5.60000000e-14, 1.12011429e-13, 2.24034286e-13, 4.48080000e-13, 8.96171429e-13, 1.79235429e-12, 3.58472000e-12,
6.99000000e-14, 5.60000000e-13, 1.10000000e-12, 2.20000000e-12, 4.50000000e-12, 9.00000000e-12, 6.99000000e-13, 5.60000000e-12, 1.12000000e-11, 2.24000000e-11,
4.48000000e-11, 8.95000000e-11]
当我对值执行插值时,[7.10000000e-05, 18]
我得到了结果7.95281146e-14
。如果我将第一列乘以10^3
结果列,10^12
那么我得到的结果将完全不同。我得到0.09352
相当于9.352e-14
.
- 有人可以解释一下为什么 scipy 在这些情况下会给出不同的结果吗?
- 这些结果中哪一个是正确的?(我尝试使用 excel,但我很快意识到 scipy 使用了不同的技术)。
- 我应该如何解决这个问题?