제곱(Square)
- 같은 수를 두 번 곱함
- 거듭 제곱 : 같은 수를 거듭하여 곱함
제곱근 (Square root, √ )
- a를 제곱하여 b가 될 때 a 를 b의 제곱근이라고 함
지수 (Exponent)
어떤 밑수를 몇 번 곱해야 하는지 나타냄
로그 (Logarithm)
- a 가 b 가 되기 위해 제곱해야 하는 수
// 기초 수학 - 지수와 로그
public class mathPractice09 {
public static void main(String[] args) {
//1. 제곱, 제곱근, 지수
System.out.println("=== 제곱 ===");
System.out.println(Math.pow(2, 3));
System.out.println(Math.pow(2, -3));
System.out.println(Math.pow(-2, -3));
System.out.println(Math.pow(-2, 30));
System.out.printf("%.0f\n", Math.pow(-2, 30)); //소수점 없애고 그대로 출력
System.out.println("=== 제곱근 ===");
System.out.println(Math.sqrt(16));
System.out.println(Math.pow(16, 1.0/2));
System.out.println(Math.pow(16, 1.0/4));
//참고) 절대 값
System.out.println("=== 절대 값 ===");
System.out.println(Math.abs(5));
System.out.println(Math.abs(-5)); //음수의 절대 값 형태
//2. 로그
System.out.println("=== 로그 ===");
System.out.println(Math.E); // 자연 상수
System.out.println(Math.log(Math.E)); // 자연 상수를 로그로 출력
System.out.println(Math.log10(1000));
System.out.println(Math.log(4) / Math.log(2));
}
}
'Study for Backend > Mathmatics Basic' 카테고리의 다른 글
[기초 수학] 점화식과 재귀함수 (0) | 2024.03.12 |
---|---|
[기초 수학] 조합 (0) | 2024.03.11 |
[기초 수학] 약수 , 최대 공약수, 최소 공배수 (0) | 2024.03.11 |
[기초 수학] 경우의 수, 합의 법칙, 곱의 법칙 (0) | 2024.03.11 |
[기초 수학] 집합 (0) | 2024.03.11 |