.


:




:

































 

 

 

 


. .




: x, x0 xk h, y(x) e=0.00001.

e = 0.000001: n = 1

For x = xh To xk Step dx

y = 0: i = 0: u = 1

 

While Abs(u) > e: y = y + u: u = (x) ^ 2 / (i + 1) * u: i = i + 1

Wend: n = n + 1

Next x

 

.

Sub Fib1()

ActiveCell.FormulaR1C1 = "1"

Range("A2").Select

ActiveCell.FormulaR1C1 = "2"

Range("A3").Select

ActiveCell.FormulaR1C1 = "=R[-2]C+R[-1]C"

Range("A3").Select

Selection.AutoFill Destination:=Range("A3:A20"), Type:=xlFillDefault: Range("A3:A20").Select

 

18. = sign(A).

Sub matAB()

Dim a(3, 3) As Integer: Dim b(3, 3) As Integer

Dim i, j As Integer: Dim s1, s2 As String

For i = 1 To 3: For j = 1 To 3

If a(i, j) > 0 Then: b(i, j) = 1: Else

If a(i, j) = 0 Then: b(i, j) = 0: Else: b(i, j) = -1: End If

End If: Range(s1).Cells = b(i, j): Next: Next: End Sub

 

19. f(x) = 0. .

x= f(x)*f (x)<0 f(x)*f (x)>0- .

:

, | xn-xn-1|< E

While Abs(f(x)) > 0.01

i = i + 1

x = x - f(x) / f1(x)

Wend

End Sub

 

20. f(x) = 0. .

:

1. (, b, )

2. (|b-a|<2), 6

3. c=(a+b)/2

4. (f()*f ()>0), =, b=c.

5. 2

6. (a+b)/2

x = Del(a, b, eps)

Function Del(a As Double, b As Double, e As Double) As Double

Dim x As Double, n As Integer

If fun(a) * fun(b) <= 0 Then

n = 0: While (b - a) > e: n = n + 1: x = (a + b) / 2

If fun(a) * fun(x) <= 0 Then

b = x: Else: a = x: End If

Range("B5").Cells = n: Del = (a + b) * 0.5

Wend: Else: MsgBox ("a,b=?")

Exit Function: End If: End Function

 

21. f(x) = 0. .

Xn+1= Xn-(f(Xn)(b- Xn))/(f(b)-f(Xn))

Xn+1= Xn-(f(Xn)(Xn-))/(f(Xn)-f(a))

| Xn+1- Xn|<Ɛ

x = Hor(a0, b0, eps)

Function Hor(a As Double, b As Double, e As Double) As Double: Dim x As Double, x0 As Double, n As Integer: If fun(a) * fun(b) <= 0 Then

n = 0: x0 = a: x = b: While Abs(x0 - x) > e

n = n + 1: x0 = x: x = b - fun(b) * (b - a) / (fun(b) - fun(a)): If fun(a) * fun(x) <= 0 Then: b = x: Else: a = x: End If: Hor = x: Wend: Else MsgBox ("a,b=?"): Exit Function: End If: End Function

 

22. . .

B : ;

m: m≥

|x(m)- x(m-1)| ≤

Xn+1= Xn-(f(Xn)(b- Xn))/(f(b)-f(Xn))

Xn+1= Xn-(f(Xn)(Xn-))/(f(Xn)-f(a))

| Xn+1 - Xn|<

:

1) x=αx+β.

2) .

3) |α| < 1, 4.

4) ε

5) i.

6) xi+1=n(xi)

7) |x(m)- x(m-1)| ≤ , , 6.

x = Hor(a0, b0, eps)

Call Iter(eps, x, n)

For i = 1 To 4

x(i) = 0: Next i: n = 0

Do: n = n + 1: l = False

For i = 1 To 4: x0(i) = x(i): Next i

For i = 1 To 4: x(i) = b(i) / a(i, i)

For j = 1 To i 1: x(i) = x(i) - a(i, j) / a(i, i) * x0(j): Next j

For j = i + 1 To 4: x(i) = x(i) - a(i, j) / a(i, i) * x0(j): Next j

If Abs(x(i) - x0(i)) > e Then: l = True

End If: Next i: Loop Until Not l: End Sub

 





:


: 2017-03-12; !; : 1157 |


:

:

- , , .
==> ...

1805 - | 1581 -


© 2015-2024 lektsii.org - -

: 0.012 .