指数関数,対数関数

[具体的な関数]

[使用例]

  1. 指数関数 と 対数関数 の使用方法です.
    #include <iostream>
    #include <cmath>
    
    using namespace std;
    
    int main()
    {
    	double v = 2.7;
    	cout << "v : " << v << endl;
    	cout << "  exp(v) " << exp(v) << " log(exp(v)) " << log(exp(v)) << endl;
    	cout << "  pow(10, v) " << pow(10, v) << " log10(pow(10, v)) " << log10(pow(10, v)) << endl;
    	cout << "  exp2(v) " << exp2(v) << " log2(exp2(v)) " << log2(exp2(v)) << endl;
    	cout << "  expm1(v) " << expm1(v) << " exp(v)-1 " <<  exp(v)-1 << endl;
    	cout << "  log1p(v) " << log1p(v) << " log(v+1) " <<  log(v+1) << endl;
    
    	return 0;
    }
    			
    (出力)
    v : 2.7
      exp(v) 14.8797 log(exp(v)) 2.7
      pow(10, v) 501.187 log10(pow(10, v)) 2.7
      exp2(v) 6.49802 log2(exp2(v)) 2.7
      expm1(v) 13.8797 exp(v)-1 13.8797
      log1p(v) 1.30833 log(v+1) 1.30833			

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