한양대 수치해석 과제, 몬테칼로 방법론 적용
- 최초 등록일
- 2015.09.06
- 최종 저작일
- 2012.05
- 8페이지/ MS 워드
- 가격 1,000원
목차
1. Let’s assume there are 100 bugs at the origin on the x-y plane. Then, the bugs step 1600 times randomly and stop at the final location. Assume the bugs step 10mm on the average(ranging from 0 to 20 mm uniformly). Write a Monte Carlo program to calculate the distances of the bugs(at the final locations) from the origin. Then, use MS Excel to calculate the average and standard deviation of the distances. Is your number close to the theoretical number (400mm)? Discuss your findings.
2. Write a Monte Carlo program, using the ‘hit-or-miss’ method, to integrate the function y=5x^2+4 from x=2 to 6. Increase the number of calculations and observe how the calculated values converse to the true value. Discuss your findings.
3. Write a program to simulate radioactive decay. Assume there are initially 2000 radioactive atoms whose decay constant is 0.01 sec-1. Calculate the number of remaining radioactive atoms for the next 500 sec. Then, compare your result with the theoretical expiation (i.e., exponential behavior). For this, please plot the remaining number of radioactive atoms versus time parameter. When you decrease the initial number of atoms to 100, is it still follow the exponential rule faithfully? Discuss your findings.
본문내용
1마리의 벌레가 총 1600번을 뛴다. 한번에 뛰는 평균 거리는 10mm이고, 방향은 360도 전방향이다. rand() 함수를 이용하여 무작위의 거리와 방향을 지정하여 그 함수를 1600번 반복하는 코드를 만들어보면 다음과 같다.
<중 략>
평균은 대체로 400전후라는 것을 확인할 수 있다. 이 값들의 평균을 구하면 405.7575가 나온다.
표준편차는 약 200이상이 나오는 것을 알 수 있다. 이는 분포가 굉장히 넓게 퍼져 있다는 것을 나타낸다. 하지만 결국 모든 데이터의 평균은 400에 가까운 값이라는 것을 확인 할 수 있다.
<중 략>
다음을 보면 알수 있듯이 n값이 커져도 error은 비례하여 0에 수렴하지 않는다는 사실을 알 수 있다. n=10일 때를 제외하고는 거의 error가 들쭉날쭉한 값을 갖는 것을 확인할 수 있다. 이는 아무래도 모든 과정이 random한 수를 대입하기 때문에 한정된 공간(x축의 범위가 좁다)에서 점을 찍는 것은 정확한 값을 측정해내기 어렵다는 것을 알 수 있다. 만약 더욱 더 넓은 공간에서(더 큰 h값과 x축의 길이) 적분값을 구할 수 있다면 error가 조금 더 안정적으로 0으로 수렴하는 그래프를 볼 수 있을 것이다. 그래서 x축의 길이와 h값을 더 늘려서 실험해보았다.
참고 자료
없음