.


:




:

































 

 

 

 


Private Sub CommandButton1_Click()




Dim n As Integer, i As Integer, j As Integer, eps As Single, x As Single

Dim s As Single, sl As Single, p As Double

Worksheets("2").Activate

x = Range("B2").Value

s = 0

If OptionButton1.Value = True Then

n = Range("B1").Value

For i = 1 To n

p = 1

For j = 1 To 2 * i

p = p * j

Next j

sl = (-1) ^ i * x ^ (2 * i) / p

s = s + sl

Next i

ElseIf OptionButton2.Value = True Then

eps = Range("B1").Value

i = 0

Do

i = i + 1

p = 1

For j = 1 To 2 * i

p = p * j

Next j

sl = (-1) ^ i * x ^ (2 * i) / p

s = s + sl

Loop While Abs(sl) >= eps

Else

MsgBox " ", vbCritical, ""

Exit Sub

End If

Range("B4").Value = s

End Sub

. 1.7.

 

1.7

 

2

, : , , , i . = -x2/2. (2i)!.

1_3_2 , . 1.8.

 

ListBox1

 

1.8 1_3_2

 

:

 

()
UserForm1 Name 1_3_2
Caption
Label1 Caption x =
Font(; ) ; 10
Label2 Caption
Font(; ) ; 10
Label3 Caption S =
Font(; ) ; 10
TextBox1 Name xv
Font(; ) ; 10
TextBox2 Name Sv
Font(; ) ; 10
ListBox1 Name Lvar
Font(; ) ; 10
CommandButton1 Caption
Font(; ) ; 12

:

Private Sub UserForm_activate()

Lvar.AddItem (" ")

Lvar.AddItem (" ")

End Sub

Private Sub CommandButton1_Click()

Dim n As Integer, i As Integer, eps As Single, x As Single, _

S As Single, sl As Single

Label3.Caption = " S="

x = CSng(xv.Text)

sl = -(x ^ 2) / 2: s = sl

If Lvar.ListIndex = 0 Then

n = InputBox( n=)

ElseIf Lvar.ListIndex = 1 Then

eps = InputBox( =)

Else

Label3.Caption = "!"

Sv.Text = " "

Exit Sub

End If

If Lvar.ListIndex = 0 Then

For i = 2 To n

sl = sl * (-(x ^ 2) / ((2 * i - 1) * (2 * i)))

s = s + sl

Next i

ElseIf Lvar.ListIndex = 1 Then

i = 1

Do

i = i + 1

sl = sl * (-x ^ 2 / ((2 * i - 1) * (2 * i)))

s = s + sl

Loop While Abs(sl) >= eps

End If

Sv.Text = s

End Sub

. 1.9.

 

1.9

 

 

1.3.3

 

,

[-2;2], 0,2. , Excel . :

1) , 䒺 ;

2) ;

3) , , ;

4) , 1).

, , EXCEL 2, 2, 2, . 1.10.

 

 

1.10 1.3.3

 

, .

, EXCEL:

 

()
CommandButton1 Caption
Font(; ) ; 12
WordWrap True
CommandButton2 Caption
Font(; ) ; 12
WordWrap True
CommandButton3 Caption
Font(; ) ; 12
CommandButton4 Caption
Font(; ) ; 12
CommandButton5 Caption
Font(; ) ; 12

 

:





:


: 2015-10-27; !; : 287 |


:

:

, ,
==> ...

1563 - | 1542 -


© 2015-2024 lektsii.org - -

: 0.02 .