Machine Learning/수치해석 5

[수치해석] Gauss Elimination을 이용한 연립 방정식 해 계산 (Python)

어떤 연립방정식이 다음과 같이 주어졌을 때,이를 행렬의 곱 Ax = b 형태로 다음과 같이 표현할 수 있다. 위 행렬을 Gauss Elimination (가우스 소거법)을 이용하여,A를 Upper triangular matrix인 row echelon form 형태로 정리하면 연립방정식의 해를 얻을 수 있다. 그 과정은 다음과 같다.1. Pivoting : 기준이 되는 각 행의 첫 요소가 가장 큰 절댓값을 가지도록 행을 변경하는 과정기준 행인 1행의 첫 요소가 가장 큰 절댓값을 갖도록 행을 바꾸어준다. 2. Forward Elimination : Pivot이 설정된 기준 행과 열에 대하여 기준 행을 제외한 기준 열의 요소를 0으로 정리한다.위 1, 2 과정을 Upper Triangular matrix (..

[수치해석] Python을 이용한 수치 미분과 Taylor series expansion을 이용한 오차 분석

어떤 함수 f(x)가 다음과 같이 주어진다고 하자.해당 함수의 도함수는 다음과 같을 것이다. 만약 컴퓨터에서 기존 함수에 대해 미분을 한 도함수를 얻고, 계산하고 싶을 때,컴퓨터는 도함수를 어떻게 유도해낼 수 있을까? 안타깝게도 컴퓨터는 함수로부터 이러한 도함수를 유도 해낼 수 없다.(컴퓨터가 다양한 함수의 도함수를 학습을 통해 얻지 않은 경우라고 가정)대신 컴퓨터는 계산이 매우 빠르기 때문에, 근사를 통해 해당 도함수와 최대한 유사하게 표현할 수 있다. 즉, 어떤 점 x_i 에서의 미분 계수를 컴퓨터에서는 x_i와 x_i+1 사이의 h를 매우 작게 계산하여 유도할 수 있다.고등학교 때 배우는 미분 계수의 정의를 생각해봐도 쉽게 이해할 수 있을 것이다. 그러나 이러한 식은 Taylor series exp..

[수치해석] Python을 이용한 Machine epsilon(한계 오차) 계산

컴퓨터는 숫자를 저장할 때 2진법으로 저장한다.따라서, 입력 받은 숫자를 2진법으로 저장하고, 저장된 숫자를 다시 10진법으로 변환하여 출력하는 과정을 거친다. 당연하게도 숫자 하나를 저장하기 위한 컴퓨터의 메모리 크기는 제한적이다.그렇기 때문에 컴퓨터의 숫자 표시 정확도에 한계가 존재한다.예를 들어, 완전한 1을 저장하고 싶다 해도 1.00000000000000..00000 이 아닌1.0000000000000011102... 이런 식으로 저장된다는 의미다.무수한 0 뒤에 표시되는 숫자는 표시 한계점 이상의 2진법과 10진법 변환 과정에서 유도되는 숫자이다.이 한계는 숫자를 담는 메모리의 크기에 따라 결정된다. 당연하게도 표시 한계 이하로부터는 컴퓨터는 더 이상 동일함을 판단할 수가 없고, 이 때문에 한..

[C++] Get area using Monte Carlo method

● What is the Monte Carlo method?We can get a complex area by using the Monte Carlo method instead of calculating it using an integral.The Monte Carlo method outputs a lot of random points within a specified range, and counts them if they are within the target area.Calculates the ratio between the number of times that the point is printed and the counted point.Then, the area of ​​the target area..

[C++] Integration with the Area of Rectangle and Trapezoid

The area of ​the first quadrant in the equation of a circle can be calculated using the integral likes below. We use integral for get the area of under the graph.But, computer can compute this as the sum of area of thin bars. (because computers have fast computational processing power) It can be obtained as shown in the figure below.There must be exist an error this way.But if we calculate δ as ..

728x90
반응형