You are on page 1of 7

2023-09-25

Secant Method and Modified Secant Method


공학수치해석
20201854 조명근
2023-09-25

Secant Method

Newton-Raphson Method Secant Method


𝑓(𝑥 )
𝑓(𝑥 ) 𝑥 =𝑥 −
𝑥 =𝑥 − 𝑓 𝑥 − 𝑓(𝑥 )
𝑓′(𝑥 )
𝑥 −𝑥

Derivative of 𝑓를 알아야 한다.


𝑓′이 복잡할 경우 계산이 복잡해진다. Derivative of 𝑓를 사용하지 않을 때
Ex) 𝑓 𝑥 = sin cos 𝑒 Solution: Use a secant instead of tangent
𝑓 𝑥 = −𝑒 sin(𝑒 )cos(cos(𝑒 ))

Newton-Raphson Method와 비슷한 형태이지만,


분모에 𝑓′(𝑥 ) 대신 두 점을 잇는 직선의 기울기로 대체된다.
이에 따라 처음에 한 점을 필요로 하는 Newton-Raphson Method와 달리
Secant Method는 처음에 두 점을 필요로 함.

2
2023-09-25

4
2023-09-25

6
2023-09-25

8
2023-09-25

10
2023-09-25

11

Modified Secant Method

Secant Method에서 𝑥 와 𝑥 의 간격을 아주 작은 값으로 하는 것


그 간격의 비율을 𝛿로 표현
𝑥 = 𝑥 + 𝛿𝑥

Secant Method와 달리 Modified Secant Method에서는 한 점만 지정하고,


설정된 𝛿로 다른 한 점을 지정

( ) ( )
𝑥 =𝑥 − ( )
=𝑥 − ( )
=𝑥 −

Secant Method에 𝑥 = 𝑥 + 𝛿𝑥 을 대입하면 위와 같은 관계식이 도출되지만,


𝑓 𝑥 −𝑓 𝑥 과𝑓 𝑥 − 𝑓 𝑥 의 차이는 𝛿의 매우 작은 값이므로
다음과 같이 표현할 수 있다.

𝛿𝑥 𝑓 𝑥
𝑥 =𝑥 −
𝑓 𝑥 −𝑓 𝑥

12
2023-09-25

Modified Secant Method


𝛿𝑥 𝑓 𝑥
double Secant(double x0, double es, int imax) 𝑥 =𝑥 −
{ 𝑓 𝑥 −𝑓 𝑥
FILE* fp = _fsopen("Secant.out", "w", _SH_DENYNO);
printf(" Secant Method \n");

double fr, xr = x0, xrold, ea = 0, xrold2, frold, frold2;


int iter = 0;
fr = function(xr); xr: 𝑥 , fr: 𝑓 𝑥
xrold = xr - xr * 0.01; 𝛿=0.01
frold = function(xrold); xrold: 𝑥 , frold: 𝑓 𝑥
do
{
xrold2 = xrold;
frold2 = frold;
frold = fr;
xrold = xr;
double df = (frold - frold2) / (xrold - xrold2); 𝑑𝑓 = =
xr = xrold - fr / df;
fr = function(xr); 𝛿𝑥 𝑓 𝑥
iter++;
new xr = 𝑥 =𝑥 −
𝑓 𝑥 −𝑓 𝑥
if (xr != 0.) ea = fabs((xr - xrold) / xr) * 100.;
fprintf(fp, " %4d %15.7e %15.7e %15.7e \n", iter, xr, fr, ea);
new fr= 𝑓 𝑥
printf(" iter= %4d xr= %15.7e fr= %15.7e error= %15.7e \n", iter, xr, fr, ea);
} while (!(ea < es || iter >= imax));
fclose(fp);

return xr;
}

13

참고자료
Secant Method. Oscar Veliz. https://www.youtube.com/watch?v=_MfjXOLUnyw&list=PLxEqU36h20yiF2uGGN9JPO2WRafi-fxX8&index=2

14

You might also like