相关代码 |
|
Function RTBIS(X1, X2, XACC) JMAX = 40 FMID = FUNC(X2) F = FUNC(X1) If F * FMID >= 0# Then Print "Root must be bracketed for bisection." End If If F < 0# Then RTBIS = X1 DX = X2 - X1 Else RTBIS = X2 DX = X1 - X2 End If For J = 1 To JMAX DX = DX * 0.5 XMID = RTBIS + DX FMID = FUNC(XMID) If FMID If Abs(DX) < XACC Or FMID = 0 Then Exit Function Next J Print "too many bisections" End Function
相关资源 |
|