Python의 수학 함수 | 세트 2(로그 및 거듭제곱 함수)

숫자 기능은 아래 세트 1에서 설명됩니다. Python의 수학 함수 | 세트 1(숫자 기능) 이 세트에서는 로그 및 거듭제곱 함수에 대해 설명합니다. 1. 특급(a) :- 이 함수는 다음의 값을 반환합니다. e의 a승(e**a) . 2. 로그(a b) :- 이 함수는 로그를 반환합니다. b를 밑으로 하는 a의 값 . 밑이 언급되지 않은 경우 계산된 값은 자연 로그입니다. 

Python
   # Python code to demonstrate the working of    # exp() and log()    # importing 'math' for mathematical operations    import   math   # returning the exp of 4    print   (  'The e**4 value is : '     end  =  ''  )   print   (  math  .  exp  (  4  ))   # returning the log of 23    print   (  'The value of log 2 with base 3 is : '     end  =  ''  )   print   (  math  .  log  (  2    3  ))   

산출:

The e**4 value is : 54.598150033144236 The value of log 2 with base 3 is : 0.6309297535714574 

시간 복잡도: 오(1)

보조 공간: 오(1)


3. 로그2(a) :- 이 함수는 다음의 값을 계산합니다. 2진법으로 로그를 기록하세요 . 이 값은 더 정확하다 위에서 설명한 함수의 값보다 4. 로그10(a) :- 이 함수는 다음의 값을 계산합니다. 10진법으로 로그를 기록하세요 . 이 값은 더 정확하다 위에서 설명한 함수의 값보다 

Python
   # Python code to demonstrate the working of    # log2() and log10()    # importing 'math' for mathematical operations    import   math   # returning the log2 of 16    print   (  'The value of log2 of 16 is : '     end  =  ''  )   print   (  math  .  log2  (  16  ))   # returning the log10 of 10000    print   (  'The value of log10 of 10000 is : '     end  =  ''  )   print   (  math  .  log10  (  10000  ))   

산출:

The value of log2 of 16 is : 4.0 The value of log10 of 10000 is : 4.0 

시간 복잡도: 오(1)

보조 공간: 오(1)


5. 펑(ab) :- 이 함수는 다음의 값을 계산하는 데 사용됩니다. a의 b제곱(a**b) . 6. sqrt() :- 이 함수는 제곱근 번호의. 

Python
   # Python code to demonstrate the working of    # pow() and sqrt()    # importing 'math' for mathematical operations    import   math   # returning the value of 3**2    print   (  'The value of 3 to the power 2 is : '     end  =  ''  )   print   (  math  .  pow  (  3    2  ))   # returning the square root of 25    print   (  'The value of square root of 25 : '     end  =  ''  )   print   (  math  .  sqrt  (  25  ))   

산출:

The value of 3 to the power 2 is : 9.0 The value of square root of 25 : 5.0 

시간 복잡도: 오(1)

보조 공간: 오(1)