タグ

AlgorithmとProgrammingに関するikajigokuのブックマーク (22)

  • 連分数

    連分数関連の処理をC++で書いて遊んでみました。 連分数の基については、Continued Fraction By Kardi Teknomo, PhD が分かりやすかったです。 冪級数展開が発散するときでも連分数展開は収束する場合があり、かつ、どちらも収束するようなケースでは連分数展開の方が収束が早い場合が多いらしく、実用的なトピックです。黄金比やネイピア数を連分数展開すると綺麗な形になるというのもまた興味を唆られます。 p/qを連分数展開する場合を考えます。 p/q = [p/q] + (p%q)/q = [p/q] + 1/(q/(p%q)) となります。 ただし、[]はfloor関数です。 a0 = [p/q], a1 = [q/(p%q)], ....となるのでこれを再帰的に考えていくとユークリッドの互除法と同じパターンになることが分かります。 #include <iostre

  • CodeProject

    Square Root Methods Fast Algorithm Speed Precision computational Quake3 Fast Square Root Function Fast Gaming Download source - 5.28 KB Introduction I enjoy Game Programming with Directx and I noticed that the most called method throughout most of my games is the standard sqrt method in the Math.h and this made me search for faster functions than the standard sqrt. And after some searching, I foun

    CodeProject