'
Dim xn As Double, xk As Double, x As Double, y As Double, _
H As Double, i As Integer, n As Integer
xn = Range("A2").Value
xk = Range("B2").Value
h = Range("C2").Value
n = (xk - xn) / h + 1
Range("D2").Value = n
Range("A4").Value = "x"
Range("B4").Value = "y"
Range("A4:B4").HorizontalAlignment = xlCenter
'
Range("A4:B4").Font.Bold = True
'
Range("A4:B4").Interior.ColorIndex = 8
'
i = 5 ' ,
For x = xn To xk Step h
If x >= xn And x <= 0 Then
y = Sqr(1 + 2 * Abs(x))
Else
y = (3 + Cos(x) ^ 2) / (1 + Sin(2 * x) ^ 2)
End If
Cells(i, 1).Value = x
Cells(i, 2).Value = y
i = i + 1
Next x
End Sub
Private Sub CommandButton2_Click()
' '
Dim Sa As Double, s As Double, k As Integer, x As Double, _
I As Integer, n As Integer
n = Range("D2").Value
s = 0: k = 0
i = 5
x = Cells(i,1).Value
Do While x < 0
s = s + Cells(i, 2).Value
k = k + 1
i = i + 1
x = Cells(i, 1).Value
Loop
Cells(n + 6, 1).Value = " "
Cells(n + 6, 1).WrapText = True
'
If k <> 0 Then
Sa = s / k
Cells(n + 7, 1).Value = Sa
Else
Cells(n + 7, 1).Value = " x<0"
End If
End Sub
Private Sub CommandButton3_Click()
'
Dim min As Double, r As Range, i As Integer, _
N As Integer
n = Range("D2").Value
min = Range("B5").Value
For Each r In Range("B5:B25")
If min > r.Value Then min = r.Value
Next
Cells(n + 6, 2).Value = "̳ ="
Cells(n + 6, 2).WrapText = True
Cells(n + 7, 2).Value = min
' ,
i = 5
Do Until i = n + 4
If Cells(i, 2).Value = min Then
Cells(i, 1).Font.ColorIndex = 7
End If
i = i + 1
Loop
End Sub
Private Sub CommandButton4_Click()
'
Dim max As Double, i As Integer, n As Integer, k As Integer, _
X As Double
n = Range("D2").Value: max = -10 ^ 10
For i = 5 To n + 4
x = Cells(i, 1).Value
If x > 0 And max < Cells(i, 2).Value Then
max = Cells(i, 2).Value
End If
Next
k = 0 ' ,
For i = 5 To n + 4
If max = Cells(i, 2).Value Then k = k + 1
Next
Cells(n + 6, 3).Value = " ="
|
|
Cells(n + 6, 3).WrapText = True
Cells(n + 7, 3).Value = max
Cells(n + 6, 4).Value = "ʳ = "
Cells(n + 6, 4).WrapText = True
Cells(n + 7, 4).Value = k
End Sub
Private Sub CommandButton5_Click()
' , '
Dim Sa As Double, P As Double, k As Integer, y As Double, _
I As Integer, n As Integer
n = Range("D2").Value: Sa = Range("A28").Value
P = 1
For i = 5 To n + 4
y = Cells(i, 2).Value
If y < Sa Then P = P * y
Next i
Cells(n + 6, 5).Value = " < "
Cells(n + 6, 5).WrapText = True
Cells(n + 7, 5).Value = P
End Sub
. 1.11.
1.11
1.4
1.4.1 ?
1.4.2 For Next .
1.4.3 .
1.4.4 .
1.4.5 , .
1.4.5 , , .
1.4.7 .
1.4.8 () .
1.4.9 .
1.4.10 vbTAB, vbCrLF.
1.5
1.5.1
y = f(x), x Î [-1;1], n=10 .
.
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25
1.5.2
x [0,1; 0,8] S:
1) n=3, n= 7;
2) =0,01, .
: , , .
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 .
1.5.3
y = f(x), , n = 20. Excel . . :
1
1) x, y< 1;
2) , .
2
1) 2;
2) , 1) .
3
1) , ;
2) .
4
1) 䒺 ;
2) , .
|
|
5
1) 0,5 1,5 ;
2) , .
6
1) <0, 䒺 ;
2) <0, , .
7
1) 䒺 , ;
2) >1,5.
8
1) 0,5 < y < 1;
2) , 1,6 .
9
1) >0 䒺 ;
2) , .
10
1) <0, 䒺 ;
2) .
11
1) <0 >0 ;
2) , . , .
12
1) , ( ) ;
2) .
13
1) x, y> 1;
2) , .
14
1) , 2,5;
2) , 1) .
15
1) 䒺 , , ;
2) , . , .
16
1) 䒺 ;
2) 䒺 , , .
17
1) 0 2 ;
2) , .
18
1) , 䒺 ;
2) , , .
19
1) <0 x>0, , ;
2) >1, .
20
1) 1<y<1,5;
2) .
21
1) >0, 䒺 ;
2) , .
22
1) <0 , , ;
2) .
23
1) , ;
|
|
2) 2.
24
1) <0 ;
2) , .
25
1) , ;
2) , , : = , .
2 ˲
2.1 . Visual Basic.: . . .;.;.: . , 1998. 456 .
2.2 .., .. Visual Basic 6.0. - .: -, 2000. 624 .
2.3 , , , . Visual Basic 6. .: . . .;.; .: . , 1999. 832 .
2.4 : . 㳿. . / . .. .: , 2001. 696 .
2.5 . , , ( ) /. .., ..- :, 1998. 26 .