Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Development tools > Assert > assert_cond2reltol

assert_cond2reltol

条件数から計算した相対誤差を提案する.

呼び出し手順

rtol = assert_cond2reltol ( condition )
rtol = assert_cond2reltol ( condition , offset )

パラメータ

condition :

doubleの行列,条件数. 条件数は厳密に正とする必要があります.

offset :

doubleの行列, 必要な10進桁数のためのシフト (デフォルト: offset=0). 例えば,offset=1は必要な精度を増加させ (相対許容誤差を10^-1倍に減らします), offset=-1は必要な精度を減らします (相対許容誤差を10^1倍に増やします).

rtol :

doubleの行列, 相対許容誤差. 相対許容誤差は厳密に正で, 1より小さい数です

説明

条件数に基づき,対応する相対許容誤差を返します.

オプションのパラメータが空の行列 [] に等しい場合, そのデフォルト値を設定します.

この相対許容誤差は単なる推奨値であることを強調しておきます. 代わりに,より小さいまたは大きな相対許容誤差を使用する 正当な理由がある場合がありえます.

  • 悪条件の問題においても, 正確な計算が可能な素晴らしいアルゴリズムがある場合を 考えてみましょう. この場合,より高い精度(正のオフセット)が必要となります.

  • 性能と精度のトレードオフがあり,性能が勝る場合について 考えてみましょう. この場合, より劣る精度(負のオフセット)が必要となります.

スカラー入力引数は全て他の入力引数と同じ大きさのdoubleの 行列に展開されます.

必要な桁数 d を計算した後,相対許容誤差 10^-d を計算します.

assert_cond2reltol ( 0 ) // 1.110D-16
assert_cond2reltol ( 1 ) // 1.110D-16
assert_cond2reltol ( 1.e1 ) // 1.110D-15
assert_cond2reltol ( 1.e2 ) // 1.110D-14
assert_cond2reltol ( 1.e3 ) // 1.110D-13
assert_cond2reltol ( 1.e16 ) // 1
assert_cond2reltol ( 1.e17 ) // 1
assert_cond2reltol ( 1.e18 ) // 1
// 行列入力.
condition = [0,1,10,100,1000,1.D13,1.D14,1.D15,1.D16,1.D17,1.D18];
expected = [1.110D-16    1.110D-16    1.110D-15    1.110D-14    1.110D-13    0.0011102    0.0111022    0.1110223    1.    1.    1.];
assert_cond2reltol ( condition )
// オフセットを使用
// Negative offset : require less accuracy
assert_cond2reltol ( 1.e2 , [0 -1] ) // [1.1D-14 1.1D-13]
// 正のオフセット : より高い精度を必要とします
// オフセットの影響を調べます
assert_cond2reltol ( 1.e2 , [0 1 2 3] ) // [1.1D-14 1.1D-15 1.1D-16 1.1D-16]
// 負のオフセット
// オフセットの影響を調べます
assert_cond2reltol ( 1.e14 , [0 -1 -2 -3] ) // [1.1D-02    1.1D-01    1 1]
// 条件数に対して相対許容誤差をプロット
condition = logspace(0,18,1000);
r = assert_cond2reltol ( condition );
plot(condition,r)
h=gcf();
h.children.log_flags="lln";
h.children.children.children.thickness=4;
xt = h.children.x_ticks;
xt.locations = 10^(0:2:18)';
xt.labels = ["10^0";"10^2";"10^4";"10^6";"10^8";"10^10";"10^12";"10^14";"10^16";"10^18"];
h.children.x_ticks=xt;
yt = h.children.y_ticks;
yt.locations = 10^-(0:2:18)';
yt.labels = ["10^0";"10^-2";"10^-4";"10^-6";"10^-8";"10^-10";"10^-12";"10^-14";"10^-16";"10^-18"];
h.children.y_ticks=yt;
xtitle("Relative tolerance","Condition","Relative tolerance");
r = assert_cond2reltol ( condition , +3 );
plot(condition,r,"r")
r = assert_cond2reltol ( condition , -3 );
plot(condition,r,"g")
legend(["Offset=0","Offset=+3","Offset=-3"]);

履歴

バージョン記述
5.4.0 関数が導入されました
Report an issue
<< assert_computedigits Assert assert_cond2reqdigits >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:02:37 CET 2019