calculate tangent of 1e100

3 ビュー (過去 30 日間)
Ben Petschel
Ben Petschel 2012 年 9 月 27 日
How do you calculate trig functions with very large arguments?
For example, in "Surely you're joking, Mr Feynman", Richard tells how he claimed to be able to solve within 60 seconds and within 10 percent any problem that can be stated in 10 seconds, but is stumped when asked to calculate tan(10^100).
MATLAB gives tan(1e100) = -0.4116 whereas google returns -0.6895. Which one is more accurate?
The MATLAB algorithm seems to not be based on simple remainders mod 2*pi, since tan(mod(1e100,2*pi)) returns 0.
  1 件のコメント
Seth DeLand
Seth DeLand 2012 年 9 月 27 日
Using Symbolic Toolbox I got:
>> vpa('tan(1e100)',100)
ans =
0.4012319619908143541857543436532949583238702611292440683194415381168718098221191211467267309749320831

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

採用された回答

Tom
Tom 2012 年 9 月 27 日
編集済み: Tom 2012 年 9 月 27 日
Given that
eps(1e100) = 1.9427e+84
it won't be that accurate.
For what it's worth, sin(1e100)/cos(1e100) gives the same answer.
(DuckDuckGo says that Wolfram Alpha says it's 0.4012319619908143541857543436532949583238702611292440)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeUtilities for the Solver についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by