[Math] log (logarithmic) function

2023. 8. 13. 19:12·.../Math
728x90
728x90

Definition of Logarithmic Function

$a>0, a\ne1$일 때

$x>0$인 $x$에 대하여

$a^y=x$이면

$$
y=\log_a x
$$

로 나타내고 $y$는 $a$를 base로 하는 logarithmic function 이라 한다.

  • 이때, $x$를 $\log_a x$의 진수 (antilogarithm)라함.
Exponential functions 의 inverse function 이
바로 logarithmic function임.
$$x=a^y \rightarrow y=\log_a x$$

 

이는 다음과 같이 애기할 수 있음.

$$a^y=a^{\log_a x}=x$$


Common Log (상용로그)

고등학교까지는 common log를 $\log$로 표시하는 게 일반적이나,
대학교에선 $\log$가 보통 natural log를 의미함.
공학 분야에서는 natural log가 일반적이기 때문에,
일반 프로그래밍 라이브러리에서도 `log` 함수는 natural log임.

base가 10인 log.

$$
y=\log_{10}x = \log x
$$

import numpy as np

np.log10(100) # 2

Natural Log

base가 $e$인 log.

$$y=\log_ex=\ln x$$

2023.10.25 - [.../Math] - [Math] Euler’s Constant (자연상수, 오일러 상수)

 

[Math] Euler’s Constant (자연상수, 오일러 상수)

Definition $$ \begin{aligned}e&=\lim_{n \to \infty}\left( 1+\frac{1}{n}\right)^n \\ &= \lim_{t \to 0} (1-t)^{\frac{1}{t}},\text{ where }t=\frac{1}{n} \end{aligned} $$ 사실, 전기, 전자, 신호처리 등에서 Euler의 수 (or Euler’s formula) 없이

dsaint31.tistory.com

import numpy as np

np.log(10) # 2.30258...
np.exp(3)  # e^3

import math

math.log(9,3) # 3을 base로, 하지만 numpy에 비해 활용도 떨어짐. 

Exponentiation 과 Log의 성질

  1. $a^xa^y = a^{x+y}$
  2. $(a^x)/ (a^y)= a^{x-y}$
  3. $(a^x)^y=a^{xy}$
  4. $(a/b)^x= (a^x) / (b^x)$
  5. $\log_a xy = \log_ax + \log_ay$
  6. $\log_a(x/y) = \log_ax - \log_ay$
  7. $\log_ax^y = y \log_ax$ : 5번의 성질에서 같은 수로 n번 곱해진 것이 n제곱임.
  8. $\log_bx = (\log_ax)/(\log_ab)$ : 2023.08.13 - [.../Math] - [Math] log의 base 변환하기.
    • $\log_bx = \frac{1}{\log_xb}$ : 8번에서 base $a$를 $x$로 
    • $\log_ab \log_ba = 1$
    • $\log_{a^m}b^n=\frac{n}{m}\log_a b$ : 8번과 7번을 이용.

Graph

아래는 base가 1보다 큰 $e$인 경우이며, y-axis를 asymptote (점근선) 으로 가지고 있음.

	import numpy as np
	import matplotlib.pyplot as plt
	import seaborn as sns
	sns.set()

	x = np.linspace(0.001, 5, 1000)
	y = np.log(x)

	plt.title('logarithmic function')
	plt.plot(x,y)
	plt.axhline(0, c='r')
	plt.axvline(0, c='r')
	plt.axvline(1, c='r', ls='--')
	plt.xlabel(r'$x$')
	plt.ylabel(r'$\log_e(x)$')
	plt.show()

특징

  • $0<x\le1$인 범위에서 기울기가 매우 가파르고,
    $1$ 이상인 경우엔 기울기가 급격히 줄어들게 됨.
    • $0$에 가까운 양의 값들인 $(0,1)$ 매우 넓은 범위로 펼쳐주는 효과가 있음
      ($0<x<1 \Rightarrow -\infty <y=\log(x)<0$)
    • 이 같은 특징으로 probability(확률)의 변수를 넓은 범위로 확장하는 경우 많이 사용됨.
  • 이와 대조적으로 1 이상인 값들은 매우 좁은 구간으로 좁혀줌.
  • 양수값만을 함숫값으로 가지는 function의 경우 (← $\log$의 domain이 positive만 가능함),
    $\log$를 적용해도 해당 함숫값의 max와 min이 나오는 위치는 변하지 않음.
    • $\underset{x}{\mathrm{argmax}}\ f(x)=\underset{x}{\mathrm{argmax}}\ \log f(x)$ , $\underset{x}{\mathrm{argmin}}\ f(x)=\underset{x}{\mathrm{argmin}}\ \log f(x)$
  • 곱하기를 더하기로 바꿈 ("antilogarithm의 곱"은 각 "log의 합"으로) : 위의 5번 성질 확인.
    • $\displaystyle \log \left( \prod_i x_i \right)=\sum_i \left( \log x_i\right)$
    • 이는 "나누기"는 "차"로 바뀜을 의미함 : 위의 6번 성질.
    • 독립인 event들의 probability의 product를 사용하는 likelihood에서 log를 사용하여 summation으로 바꿔줌.

같이보면 좋은 자료들

2024.02.26 - [.../Math] - [Math] Exponential Function (지수함수)

 

[Math] Exponential Function (지수함수)

지수함수 (exponential function) $a>0$이고 $a\ne 0$이면서 $x$가 real number(실수)일 때,다음의 function을 exponential function이라고 한다.$$y=a^x$$$a$ : base (밑수, 밑)$x$ : exponent or power (지수)$a$ to the $x$th power, $a$ (ra

dsaint31.tistory.com

2024.02.28 - [.../Math] - [Math] Limits of Log and Exponential Functions

 

[Math] Limits of Log and Exponential Functions

대표적인 경우들은 다음과 같음. $$\underset{x\to 0}{\lim} \frac{\log(1+x)}{x}=1$$ $$\underset{x\to 0}{\lim} \frac{\log_a(x+1)}{x} = \frac{1}{\log a}$$ $$\underset{x\to 0}{\lim} \frac{e^x -1}{x}=1$$ $$\underset{x\to 0}{\lim} \frac{a^x -1}{x}=\lo

dsaint31.tistory.com

 


 

'... > Math' 카테고리의 다른 글

[Math] Random Variable의 연산에 따른 Mean과 Variance.  (0) 2023.08.14
[Math] log의 base 변환하기.  (0) 2023.08.13
[Math] Rotation Vector (= Axis-Angle, Rodrigues Angle)  (0) 2023.08.05
[ML] Cosine Similarity  (0) 2023.07.23
[Math] Sequence (수열) and Series (급수)  (0) 2023.07.21
'.../Math' 카테고리의 다른 글
  • [Math] Random Variable의 연산에 따른 Mean과 Variance.
  • [Math] log의 base 변환하기.
  • [Math] Rotation Vector (= Axis-Angle, Rodrigues Angle)
  • [ML] Cosine Similarity
dsaint31x
dsaint31x
    반응형
    250x250
  • dsaint31x
    Dsaint31's blog
    dsaint31x
  • 전체
    오늘
    어제
    • 분류 전체보기 (740)
      • Private Life (13)
      • Programming (186)
        • DIP (104)
        • ML (26)
      • Computer (119)
        • CE (53)
        • ETC (33)
        • CUDA (3)
        • Blog, Markdown, Latex (4)
        • Linux (9)
      • ... (351)
        • Signals and Systems (103)
        • Math (172)
        • Linear Algebra (33)
        • Physics (42)
        • 인성세미나 (1)
      • 정리필요. (54)
        • 의료기기의 이해 (6)
        • PET, MRI and so on. (1)
        • PET Study 2009 (1)
        • 방사선 장해방호 (4)
        • 방사선 생물학 (3)
        • 방사선 계측 (9)
        • 기타 방사능관련 (3)
        • 고시 (9)
        • 정리 (18)
      • RI (0)
      • 원자력,방사능 관련법 (2)
  • 블로그 메뉴

    • Math
    • Programming
    • SS
    • DIP
  • 링크

    • Convex Optimization For All
  • 공지사항

    • Test
    • PET Study 2009
    • 기타 방사능관련.
  • 인기 글

  • 태그

    Convolution
    Programming
    Probability
    linear algebra
    SIGNAL
    numpy
    opencv
    Vector
    signals_and_systems
    fourier transform
    function
    signal_and_system
    SS
    검사
    Python
    math
    인허가제도
    random
    Term
    Optimization
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
dsaint31x
[Math] log (logarithmic) function
상단으로

티스토리툴바