フィルターのクリア

why matlab Make a mistake in calculating sin and cos while teta in wiling to zero ?

2 ビュー (過去 30 日間)
dear all
as it is obvious base on the Taylor series or l'hopital's rule , answer the below equation is 1/2
Taylor series :
(1-cos(teta))/(teta^2)= 1/2! - (teata^2)/4!
and while teta wiling to zero others terms become zero and the answer is 1/2
l'hopital's rule
(1-cos(teta))/(teta^2)= sin(teta)/(2*teta) =(1/2)*(cos(teta))
and again while teta wiling to zero answer is 1/2
but matlab act different and it gives right answer when you assume that teta is 0.01 or 0.001 but when you assume that teta is 0.00001 matlab give zero answer to this equation
is it my fault or something wrong with matlab and i really appreciated if some one can help me and if let me know if there is code for my problem

採用された回答

Walter Roberson
Walter Roberson 2018 年 1 月 26 日
By teta = .0000001 then cos(teta) becomes 1 to the limit of double precision, considering round-off error. Then 1-cos(teta) is 0, so you get 0 as the result.
This is a limitation in numeric processing with finite precision. If double precision had (for example) 80 bits instead of 53, then the problem would still occur, just with a smaller x.
  2 件のコメント
shahin hashemi
shahin hashemi 2018 年 1 月 26 日
thank you for your attention mr walter
is there any way to increase this limitation that cause the round off error ?
Walter Roberson
Walter Roberson 2018 年 1 月 26 日
The Symbolic toolbox is the main supported tool for extended precision. You could also look at https://www.mathworks.com/matlabcentral/fileexchange/6446-multiple-precision-toolbox-for-matlab (read the comments on the submission for some corrections.)

サインインしてコメントする。

その他の回答 (1 件)

Torsten
Torsten 2018 年 1 月 26 日
編集済み: Torsten 2018 年 1 月 26 日
https://de.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html
Use symbolic maths instead of numerical:
https://de.mathworks.com/help/symbolic/limit.html
Best wishes
Torsten.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by