.


:




:

































 

 

 

 





, .. , . , .

2.4) , :

2.4.1) :

,
. 4.5.4-1.

ListBo x , ListBox1. , . , , . ListBox ( ) .

. Items (Collections), ListBox, . , <Enter>, .

Button1 :
, Button2 .

 

 

4.5.4 - 1. 1- 5-1:
y=f(x)
[a; b] h

 

2.4.2) :

, . 4.5.4-3

.

 

4.5.4-3

Form1 Text 4.5.
Label1 Name Label1
Text
ForeColor
Font Microsoft Sans Serif, , 8
Label2 Name Label2
Text
ForeColor
Font Microsoft Sans Serif, , 8
Label3 Name Label3
Text
ForeColor
Font Microsoft Sans Serif, , 8
Label4 Name Label4
Text n=
ForeColor
Font Microsoft Sans Serif, , 8
Label5 Name Label5
Text
ForeColor
Font Arial, , 12
TextBox1 Name TextBox1
Text f(x)=sin(x+2)*12+cos(x*4)*15
ForeColor
Font Microsoft Sans Serif, , 10
TextBox2 Name TextBox2
Text
ForeColor
Font Microsoft Sans Serif, , 8
TextBox3 Name TextBox3
Text f(x)
ForeColor
Font Microsoft Sans Serif, , 8
TextBox8 Name TextBox8
Text
ForeColor
Font Microsoft Sans Serif, , 8
TextBox10 Name TextBox10
Text
ForeColor
Font Microsoft Sans Serif, , 8
TextBox12 Name TextBox12
Text
ForeColor
Font Microsoft Sans Serif, , 8
TextBox14 Name TextBox7
Text
ForeColor
Font Microsoft Sans Serif, , 8
TextBox4 TextBox5 TextBox6 TextBox7 TextBox9 TextBox11 TextBox13 TextBox15 Name TextBox4, TextBox5, TextBox6, TextBox7, TextBox9, TextBox11, TextBox13, TextBox15
Text  
ForeColor
Font Microsoft Sans Serif, , 8
ListBox1 Name ListBox1
ForeColor
Font Microsoft Sans Serif, , 8
ListBox2 Name ListBox2
ForeColor
Font Microsoft Sans Serif, , 8
Panel1 Name Panel1
Font Microsoft Sans Serif, , 8
AutoScroll True
Button1 Name Button1
Text
Button2     Name Button2
Text

 


2.4.3) :

. 4.5.4-2.

 

 

. 4.5.4-2. Fun(x) RegCikl 1- 5-1: y=f(x) [a; b] h

2.4.4) :

. 4.5.4-3.

 

Imports System.Math Public Class Form1 ' TextBox Function vvod(ByVal T As TextBox) As Double Return Val(T.Text) End Function ' TextBox Sub vivod(ByVal Z As Double, ByVal T As TextBox) T.Text = Format(Z, "00.0000") End Sub ' ListBox Sub vivodList(ByVal Z As Double, ByVal LB As ListBox) LB.Items.Add(Format(Z, "00.0000")) End Sub ' TextBox Sub vivodint(ByVal Z As Integer, ByVal T As TextBox) T.Text = CStr(Z) End Sub ' Public Function Fun(ByVal x As Double) As Double Return Sin(x + 2) * 12 + Cos(x * 4) * 15 End Function ' Public Sub RegCikl(ByVal a As Double, ByVal b As Double,_ ByVal h As Double, ByRef max As Double, _ ByRef min As Double, ByRef n1 As Integer, _ ByRef n2 As Integer) Dim i As Integer, n As Integer, y As Double, x As Double n = CInt((b - a) / h + 1) ' vivodint(n, TextBox7) x = a: n1 = 0: n2 = 0 max = Double.MinValue: min = Double.MaxValue For i = 1 To n y = Fun(x) If y > max Then max = y: If y < min Then min = y If y > 0 Then n1 = n1 + 1: If y < 0 Then n2 = n2 + 1 vivodList(x, ListBox1): vivodList(y, ListBox2) x = x + h Next End Sub Private Sub Button1_Click(sender As Object, _ e As EventArgs) Handles Button1.Click Dim nn1 As Integer, nn2 As Integer Dim mm1 As Double, mm2 As Double Dim a As Double, b As Double, h As Double a = vvod(TextBox4): b = vvod(TextBox5): h = vvod(TextBox6) RegCikl(a, b, h, mm1, mm2, nn1, nn2) ' . . vivod(mm1, TextBox9): vivod(mm2, TextBox11) vivodint(nn1, TextBox13): vivodint(nn2, TextBox15) End Sub Private Sub Button2_Click(sender As Object, _ e As EventArgs) Handles Button2.Click End End Sub End Class

 

. 4.5.4-3. 1- 4.5-1: y=f(x) [a;b] h

 

2.5) :

. 4.5.4-4.

 

4.5.4-4. 1- 5-1: y=f(x) [a;b] h

2.6) :

Microsoft Excel, , .

 

3) 2- :

3.1) :

.

y1(x, y) x [a; b] h1 y [c; d] h2.

3.2) :

5-2

y1(x, y) x [a; b] h1 y [c; d] h2 (=-1; =2; =-1; d=2; h1=1; y2=1).

3.3) :

, .. , , .

3.4) , :

3.4.1) :

,

. 4.5.4-5.


. 4.5.4-5. 2- 5-2: y1(x, y) x [a; b] h1 y [c; d] h2

3.4.2) :

.

3.4.3) :

.4.5.4-6.

 

. 4.5.4-6. fun1(), fun2() Cikl()

2- 5-2:

y1(x, y) x [a;b] h1 y [c;d] h2

;

2- . 4.5.4 -7.

 

Public Class Form1 Function vvod(ByVal t As TextBox) As Double Return Val(t.Text) End Function Sub vivodlist(ByVal z As Double, ByVal lb As ListBox) lb.Items.Add(Format(z, "00.0000")) End Sub Public Function fun1(ByVal x As Double, _ ByVal y As Double) As Double Return x ^ 2 + y ^ 2 End Function Public Function fun2(ByVal x As Double, _ ByVal y As Double) As Double Return x + y End Function Public Sub Cikl(ByVal a As Double, ByVal b As Double,_ ByVal c As Double, ByVal d As Double, _ ByVal h1 As Double, ByVal h2 As Double) Dim i, j, n1, n2 As Integer Dim x, y, y1 As Double n1 = CInt(Fix(b - a)/h1 + 1): n2 = CInt(Fix(d - c)/h2 + 1) x = a For i = 1 To n1 y = b For j = 1 To n2 If (x > 0 And x < 1) And (y > 0 And y < 1) Then y1 = fun1(x, y) Else y1 = fun2(x, y) End If vivodlist(x, ListBox1): vivodlist(y, ListBox2) vivodlist(y1, ListBox3) y = y + h2 Next x = x + h1 Next End Sub Private Sub Button1_Click(sender As Object, _ e As EventArgs) Handles Button1.Click Dim a, b, c, d, h1, h2 As Double a = vvod(TextBox1): b = vvod(TextBox2) c = vvod(TextBox3): d = vvod(TextBox4) h1 = vvod(TextBox5) h2 = vvod(TextBox6) Cikl(a, b, c, d, h1, h2) End Sub Private Sub Button2_Click(sender As Object,_ e As EventArgs) Handles Button2.Click End End Sub End Class

. 4.5.4 -7. 2- 5-2: y1(x, y) x [a;b] h1 y [c;d] h2

 

. 4.5.4 -8.

. 4.5.4 -8. [OV1] 2- 5-2: y1(x, y) x [a;b] h1 y [c;d] h2

3.6) :

, , .

 

1) , ?

2) For -?

3) For ?

4) For?

5) , ?

6) , ?

7) VB ?

8) , ?

9) , , , ?

10) , ?

11) Exit For?

12) : ; () ;

13) () ?

14) ?

15) () ?

16) () ?

17) , ?

18) ?

19) ?

20) Fr Next?

21) ?

22) Step?

23) , ?

24) , ?

[OV1]





:


: 2016-11-18; !; : 374 |


:

:

,
==> ...

1692 - | 1630 -


© 2015-2024 lektsii.org - -

: 0.036 .