誤差関数,ガンマ関数

[具体的な関数]

[使用例]

  1. erf,erfc,tgamma,lgamma の使用方法です.
    #include <iostream>
    #include <cmath>
    
    using namespace std;
    
    int main()
    {
    			// elf
    	cout << "elf\n";
    	cout << "  erf(-∞) " << erf(-numeric_limits<double>::infinity()) << endl;
    	cout << "  erf(0) " << erf(0.0) << endl;
    	cout << "  erf(1) " << erf(1.0) << endl;
    	cout << "  erf(∞) " << erf(numeric_limits<double>::infinity()) << endl;
    			// elfc
    	cout << "elfc\n";
    	cout << "  erfc(-∞) " << erfc(-numeric_limits<double>::infinity()) << endl;
    	cout << "  erfc(0) " << erfc(0.0) << endl;
    	cout << "  erfc(1) " << erfc(1.0) << endl;
    	cout << "  erfc(∞) " << erfc(numeric_limits<double>::infinity()) << endl;
    			// tgamma
    	cout << "tgamma\n";
    	cout << "  tgamma(2.5) " << tgamma(2.5) << endl;
    	cout << "  tgamma(4)(3!と同じ) " << tgamma(4.0) << endl;
    			// tgamma
    	cout << "lgamma\n";
    	cout << "  lgamma(2.5) " << lgamma(2.5) << " log(tgamma(2.5)) " << log(tgamma(2.5)) << endl;
    	cout << "  lgamma(4) " << lgamma(4.0) << " log(tgamma(4.0)) " << log(tgamma(4.0)) << endl;
    
    	return 0;
    }
    			
    (出力)
    elf
      erf(-∞) -1
      erf(0) 0
      erf(1) 0.842701
      erf(∞) 1
    elfc
      erfc(-∞) 2
      erfc(0) 1
      erfc(1) 0.157299
      erfc(∞) 0
    tgamma
      tgamma(2.5) 1.32934
      tgamma(4)(3!と同じ) 6
    lgamma
      lgamma(2.5) 0.284683 log(tgamma(2.5)) 0.284683
      lgamma(4) 1.79176 log(tgamma(4.0)) 1.79176
    			

菅沼ホーム 本文目次 演習問題解答例 付録目次 索引