<< primes Discrete mathematics elementarymatrices >>

Scilab Help >> Elementary Functions > Discrete mathematics > rat

rat

浮動小数点数の有理数近似

呼び出し手順

[N,D]=rat(X [,tol])

Y=rat(X [,tol])

引数

X

実数のベクトルまたは行列

tol

正の実数スカラー, 許容誤差 (下記参照). デフォルト値は1d-6.

N

整数のベクトルまたは行列

D

整数のベクトルまたは行列

Y

実数のベクトルまたは行列

説明

[N,D] = rat(X,tol) は, abs(N./D - X) <= tol*norm(X,1)*abs(X)の基準で N./DXに近くなるような 2つの整数行列を返します.

y=rat(x,tol) は商 N./Dを返します.

有理数近似は分数展開を丸めることにより生成されます.

[n,d]=rat([3.5, 1.333333,-0.8])
[n,d]=rat(%pi)
[n,d]=rat(%pi,1.d-12)
n/d-%pi

参照


Report an issue
<< primes Discrete mathematics elementarymatrices >>