Читайте также:
|
|
|
| |||||
|
Код подпрограммы вычисления корня
Private Sub koren(ByVal pred As Integer, ByVal a As Single, ByVal b As Single, ByVal eps As Single, ByRef xw As Single, ByRef it As Integer, ByRef Flag As Boolean)
Dim xn1 As Single, xs As Single
Dim fxn1 As Single, fxn2 As Single
Dim d As Single, Bool As Boolean
xn1 = (a + b) / 2
it = 0
fxn1 = f1(xn1)
fxn2 = f2(xn1)
Do
xs = f2(xn1)
it = it + 1
d = xs - xn1
xn1 = xs
Bool = Abs(d) < eps Or it >= pred
Loop Until Bool
If it <= pred Then
Flag = False
xw = xs
Else
Flag = True
End If
Дата добавления: 2015-08-02; просмотров: 133 | Нарушение авторских прав
<== предыдущая страница | | | следующая страница ==> |
Метод простых итераций | | | Полный код программы |