Поможем написать учебную работу
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Dim x() As Single, y() As Single, k() As Single, z() As Single, p() As Single
Private y(0) As Single
Private x0 As Single
Private xk As Single
Private C As Single
Function f(t As Single, q As Single) As Single
f = (q+1)/t
End Function
Private Sub Command1_Click()
x0 = Val(Text1.Text)
xk = Val(Text2.Text)
y(0) = Val(Text4.Text)
h = Val(Text3.Text)
p(0) = y(0)
z(0) = y(0)
n = Round((xk - x0) / h)
C = (y(0) +1)/x0
MSFlexGrid1.Rows = n + 2
MSFlexGrid1.TextMatrix(0, 0) = "X"
MSFlexGrid1.TextMatrix(0, 1) = "P"
MSFlexGrid1.TextMatrix(0, 2) = "Yэ"
MSFlexGrid1.TextMatrix(0, 3) = "Yэм"
Max = y(0)
Min = y(0)
For i = 0 To n
x(i) = x0 + i * h
p(i) = Round(C * (x(i)-1), 3)
y(i + 1) = Round(y(i) + f(x(i), y(i)) * h, 3)
z(i + 1) = Round(z(i) + f(x(i) + h / 2, z(i) + h / 2 * f(x(i), z(i))) * h, 3)
If y(i) > Max Then Max = y(i)
If y(i) < Min Then Min = y(i)
MSFlexGrid1.TextMatrix(i + 1, 0) = Str(x(i))
MSFlexGrid1.TextMatrix(i + 1, 1) = Str(p(i))
MSFlexGrid1.TextMatrix(i + 1, 2) = Str(y(i))
MSFlexGrid1.TextMatrix(i + 1, 3) = Str(z(i))
Next i
Picture1.Cls
kx = (Picture1.Width - d) / (xk - x0)
ky = (Picture1.Height - e) / (Max - Min)
Label4.Caption = Str(Min)
Label5.Caption = Str(Max)
Label6.Caption = Str(x0)
Label7.Caption = Str(xk)
For i = 0 To n - 1
z1 = Round(a + (x(i) - x0) * kx)
z2 = Round(b - (y(i) - Min) * ky)
z3 = Round(a + (x(i + 1) - x0) * kx)
z4 = Round(b - (y(i + 1) - Min) * ky)
z5 = Round(b - (p(i) - Min) * ky)
z6 = Round(b - (p(i + 1) - Min) * ky)
z7 = Round(b - (z(i) - Min) * ky)
z8 = Round(b - (z(i + 1) - Min) * ky)
Picture1.Line (z1, z7)-(z3, z8)
Picture1.Line (z1, z5)-(z3, z6)
Picture1.Line (z1, z2)-(z3, z4)
Next i
End Sub
Private Sub Command2_Click()
End
End Sub
Конец
Line (z1, z2)-(z3, z4)
z5 = (b - (p(i) - Min) * ky)
4 = (b - (y(i + 1) - Min) * ky)
Line (z1, z5)-(z3, z6)
ky)
Line (z1, z7)-(z3, z8)
ky)
z8 = (b - (z(i + 1) - Min) * ky)
z7 = (b - (z(i) - Min) * ky)
z6 = (b - (p(i + 1) - Min) * ky)
z3 = (a + (x(i + 1) - x0) * kx)
z2 = (b - (y(i) - Min) * ky)
z1 = a + (x(i) - x0) * kx
i = 0 to n-1
ky = (Picture1.Height - e) / (Max - Min)
kx = (Picture1.Width - d) / (xk - x0)
Шаблон графика
Min = Y(i)
Y(i)<min
Max = Y(i)
Y(i)>max
min, max, x0, xk
3
2
1
3
2
1
z(0)=y(0)
p(0)=y(0)
c=(y(0)+1)/x0
n = (xk x0)/h
x0, xk, y(0), h
Начало
i = 0 to n
Min = F(x0,y0)
Max = F(x0,y0)
z(i + 1) =(z(i) + F(x(i) + h / 2, z(i) + h / 2 * F(x(i), z(i))) * h)
y(i + 1)=(y(i) + F(x(i), y(i)) * h)
p(i) =(C * (x(i)-1))
x(i) = x0 + i*h