Численные методы решения прикладных задач - page 189

189
IntLP = 0
IntLP1 = 100
While Abs(IntLP - IntLP1) > e
IntLP1 = IntLP
IntLP = 0
For i = 1 To n
IntLP = IntLP + F(A + (i - 1) * h) * h
Next i
n = n * 2
h = h / 2
Wend
ActiveSheet.Cells(7, 1).Value = "По методу левых прямоугольников = " &
Str(IntLP)
n = ActiveSheet.Cells(2, 4).Value
h = (B - A) / n
IntPP = 0
IntPP1 = 100
While Abs(IntPP - IntPP1) > e
IntPP1 = IntLP
IntPP = 0
For i = 1 To n
IntPP = IntPP + F(A + i * h) * h
Next i
n = n * 2
h = h / 2
Wend
ActiveSheet.Cells(8, 1).Value = "По методу правых прямоугольников = " &
Str(IntPP)
n = ActiveSheet.Cells(2, 4).Value
h = (B - A) / n
IntCP = 0
IntCP1 = 100
While Abs(IntCP - IntCP1) > e
IntCP1 = IntCP
IntCP = 0
For i = 1 To n
IntCP = IntCP + F(A + (i - 0.5) * h) * h
Next i
n = n * 2
h = h / 2
Wend
ActiveSheet.Cells(9, 1).Value = "По методу центральных прямоугольников = "
&Str(IntCP)
n = ActiveSheet.Cells(2, 4).Value
h = (B - A) / n
IntTR = 0
IntTR1 = 100
While Abs(IntTR - IntTR1) > e
IntTR1 = IntTR
IntTR = 0
For i = 1 To n - 1
I...,179,180,181,182,183,184,185,186,187,188 190,191,192,193,194,195,196,197,198,199,...284
Powered by FlippingBook