Реферат: Приближенное вычисление определенных интегралов
Dim b As Double, a As Double
Dim chet As Double, nechet As Double
Dim delta As Double, result As Double
a = 2 '(*)
b = 5 '(**)
t = True
Do
n = InputBox("Введите четное число n", "Запрос")
If n Mod 2 = 0 Then t = False
Loop While t
delta = (b - a) / n
chet = 0
nechet = 0
For i = 1 To n - 1
If (i Mod 2) = 0 Then
chet = chet + (f(a + (delta * i)))
Else
nechet = nechet + (f(a + (delta * i)))
End If
Next i
result = (delta / 3) * (f(a) + f(b) + (2 * chet) + (4 * nechet))
MsgBox result, vbInformation, "Результат"
End Sub
Function f(x) As Double
f = 1 / (Log(x)) '(***)
End Function