Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 유효성검사
- 스프링 부트 핵심 가이드
- MariaDB
- 데이터베이스 연동
- 인텔리제이
- 백엔드공부
- 제로베이스
- 엔티티 설계
- auditing
- DAO 연동 컨트롤러 서비스 설계
- JPA
- DAO 설계
- 스프링부트실전가이드
- 백엔드스쿨
- 프로젝트 생성
- Java
- ORM
- Swagger
- 리포지토리 인터페이스
- #devops #terraform #state
- 제로베이스 #백엔드 #Java #Spring #개발자 #백엔드공부 #백엔드 스쿨
- spring
- 개발자
- validated
- 백엔드
Archives
- Today
- Total
JeongJin's Blog
지수와 로그 개념과 자바로 구현해 보기 본문
1. 제곱
- 같은 수를 두 번 곱함
- 거듭 제곱 : 같은 수를 거듭하여 곱합
2. 제곱근
- a를 제곱하여 b가 될 대 a를 b의 제곱근이라고 함
- a = 2^3, b= 8
public class Main {
public static void main(String[] args) { // 1. 제곱, 제곱근, 지수 System.out.println("== 제곱 =="); System.out.println(Math.pow(2, 3)); // 8 System.out.println(Math.pow(2, -3)); // 0.125 System.out.println(Math.pow(-2, -3)); // - 0.125 System.out.println(Math.pow(2, 30)); // 1.073741824E9 System.out.printf("%.0f\n", Math.pow(2, 30)); // 1073741824 System.out.println("== 제곱근 =="); System.out.println(Math.sqrt(16)); // 4 System.out.println(Math.pow(16, 1.0 / 2)); // 4 } } |
3. 로그
- a가 b가 되기 위해 제곱해야 하는 수
public class Main {
public static void main(String[] args) { System.out.println("== 로그 =="); System.out.println(Math.E); // 2.718281828459045 System.out.println(Math.log(Math.E)); // 1 System.out.println(Math.log10(1000)); // 3 } } |
'1일1공부 > 기초수학' 카테고리의 다른 글
알고리즘 복잡도 개념과 자바로 구현해 보기 (0) | 2023.09.10 |
---|---|
점화식과 재귀함수 개념과 자바로 구현해보기 (0) | 2023.09.09 |
조합의 개념 이해와 자바로 구현해 보자 (0) | 2023.09.07 |
순열의 개념 이해와 자바로 구현해 보자 (0) | 2023.09.07 |
경우의 수를 자바를 이용하여 이해하기 (0) | 2023.09.06 |