runge-kutta방법을이용한상미 분방정식의풀이 · contents 1. what is the...

16
Runge-Kutta 방법을 이용한 상미 분 방정식의 풀이

Upload: others

Post on 17-Jan-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

Runge-Kutta 방법을 이용한 상미분 방정식의 풀이

Page 2: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

Contents

1. What is the Runge-Kutta Method?

2. Solutions of ODEs by using the Visual Basic for Applications

- Building User-defined functions in VBA

- Solutions using by the 2nd order RK- Solutions using by the 4th order RK

Page 3: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

- Runge-Kutta 수학적 유도

Page 4: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

ℎ+ ℎ2

( + ℎ2 , + 2 )= ℎ ∙ ( , )

, = , = ℎ ∙ ( , )

( + ℎ2 , + 2 )( + ℎ, + )

기울기 6개를 가지고평균을 내서 구함!

Page 5: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

Runge-Kutta

2nd order

= + 1 − + ( ≠ 0)= ℎ ∙ ( , )= ℎ ∙ + , +Runge-Kutta

3rd order

= + 16 ( + 4 + )= ℎ ∙ ( , )= ℎ ∙ + , += ℎ ∙ + ℎ, − 2 + 2Runge-Kutta

4th order

= + 16 ( + 2 + 2 + )= ℎ ∙ ,= ℎ ∙ + , += ℎ ∙ + , += ℎ ∙ + ℎ, + , =

Page 6: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

Solutions of ODEs by using the Visual Basic for Applications

- Building User-defined functions in VBA[Alt+F11] key를 눌러 VB 에디터를 호출

Page 7: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

메뉴의 [삽입>모듈]로 모듈을 만든 후, 다음을 입력한다.

사용자함수이름

함수에 사용될 변수이름

데이터형식

함수 정의

변수가 2개 사용되서

Page 8: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

- Solutions using by the 2nd order RK1. 셀 [h] 지정

2. [ =h*plusHap(C8, E8) ] 입력

3. [ =h*plusHap(C8+h/2, E8+F8/2) ] 입력

4. [ =E8+G8 ] 입력

5. [ =D8 ] 입력

Page 9: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

자동 채우기로 , , 순으로 자동채움

1 23

Page 10: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

4개의 셀을 같이 선택한 후 자동채움

Page 11: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined
Page 12: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

- Solutions using by the 4th order RK1. 셀 [h] 지정

2. [ =h*plusHap(C8, E8) ]

3. [ =h*plusHap(C8+h/2, E8+F8/2) ]

4. [ =h*plusHap(C8+h/2, E8+G8/2) ]

5. [ =h*plusHap(C8+h, E8+H8) ]

6. [ =E8+(F8+2*G8+2*H8+I8)/6 ]

7. [ =D8 ]

Page 13: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined
Page 14: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined
Page 15: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

-> 차수가 높아질수록 오차가 줄어듬!!

* 비교

Page 16: Runge-Kutta방법을이용한상미 분방정식의풀이 · Contents 1. What is the Runge-KuttaMethod? 2. Solutions of ODEs by using the Visual Basic for Applications-Building User-defined

Summary

1. Runge-Kutta법 : - 도함수의 평균값으로 수치해석- 차수가 높을수록 정밀

2. 비쥬얼베이직에디터 호출방법 : [Alt+F11] key

3. 모듈 작성하는 방법 : [메뉴>삽입>모듈]