`odepack` 中的 `lsoda`:相对容差是否会覆盖绝对容差,还是相反?

计算科学 数值分析
2021-12-01 18:34:58

我想将数字进行比较。xx=x+Δx

如果我选择了绝对公差,那么:atol=0.1

|Δx|<atolxx

如果我选择了相对容差,那么:rtol=0.1

|Δxx|<rtolxx

当我设置时会发生什么?相对公差检查是否会覆盖绝对公差检查?rtol=atol=0.1

1个回答

这在很大程度上取决于它在特定软件中的实现方式,因此您需要检查文档或源代码。对于lsoda文档指出:

The estimated local error in Y(i) will be controlled
so as to be roughly less (in magnitude) than

EWT(i) = RTOL*ABS(Y(i)) + ATOL     if ITOL = 1, or
EWT(i) = RTOL*ABS(Y(i)) + ATOL(i)  if ITOL = 2.

Thus the local error test passes if, in each
component, either the absolute error is less than
ATOL (or ATOL(i)), or the relative error is less
than RTOL.

Use RTOL = 0.0 for pure absolute error control, and
use ATOL = 0.0 (or ATOL(i) = 0.0) for pure relative
error control.  Caution:  Actual (global) errors may
exceed these local tolerances, so choose them
conservatively.

所以在这种情况下,无论满足哪个容差都会覆盖另一个容差。