.


:




:

































 

 

 

 


1




 

1. 1, 2.

2. .

3. 4 ( ).

4. , Visual Basic for Applications (VBA).

5. 2 3 . ( ), , , . , .

 

 

 

 

 

 

 

 

:

( )

 

 

-2010

 

1

 

: , , .

 

1

1

Y=F1+F2, , . x . . A, B .

 

Option Explicit

Sub Zadanie_1() -

Const Alfa = 0.5, Betta = 0.2

Dim x as double, A as double, B as double

Dim F1 as double, F2 as double, Y as double

A = 3.4

B = 12.6

x = Val(InputBox( x)) x

F1 = Abs(Alfa+x^2)^B

F2 = Exp(Alfa+x)*Cos(Betta-A)

Y = F1 + F2

MsgBox(F1= & F1 & F2= & F2)

Msgbox(Y= & Y)

End Sub

 

2

 

x 2 6 0,5. F1 F2 1.

 

 

 

Sub Zadanie_2()

Const Alfa = 0.5, Betta = 0.2

Dim x as double, A as double, B as double

Dim Y as double, I as Integer

A = 3.4

B = 12.6

Cells(1,1) = X A1 X

Cells(1,2) = Y B1 Y

I=2

For x=-2 To 6 Step 0.5 x

If (x>=0) And (x<=2) Then Y = Abs(Alfa+x^2)^B

If x>2 Then Y = Exp(Alfa+x)*Cos(Betta-A)

Cells(I,1) = x x AI

Cells(I,2) = Y Y BI

I = I + 1 -

Next x

End Sub

3

 

.

 

Sub Zadanie_3()

Const N=10

Dim A(N) as Integer, I as Integer, S as double, K as Integer

Dim Sr as double, Max as Integer, Imax as Integer

WorkSheets(2).Select 2

Cells(1,1) =

Randomize

For I = 1 To N

A(I) = Int(Rnd*20 10) - . 10 10

Cells(2,I) = A(I)

Next I

S = 0: K = 0: Max = -32000

For I = 1 To 10

If A(I) <> 0 Then , 0

S = S + A(I)

K = K + 1

End If

If (A(I) >=Max) And (A(I) Mod 2 = 0) Then

Max = A(I)

Imax = I

End If

Next I

If K <> 0 Then Sr = S/K Else Sr=0 .

Cells(4,1) = S =

Cells(4,2) = S

Cells(5,1) = K =

Cells(5,2) = K

Cells(6,1) = Sr =

Cells(6,2) = Sr

Cells(7,1) = Max =

Cells(7,2) = Max

Cells(8,1) = Imax =

Cells(8,2) = Imax

End Sub

 

1

 

 

1

Y = f1+f2+f3+f4. x . , , , D . a, b, g .

 

N f1 f3
 
 
 
 
 
 
 
 
N f1 f3
 
 

 

 

N f2 f4
 
 
 
 
 
 
 
 
 
 

 

2

X dx. f1, f2, f3, f4 1.

 

N _1 _2 _ 3 _4
  x > 0 -3 £ x £ 0 x < -3
  x > 2 -1 £ x £ 2 x < -1
  x < -2 -2 £ x £ 3 > 4 3 < < 4
  -4 £ x £ -2 x > 4 2 £ x £ 4 -2 < x < 2
  x < 0 x > 4 0 £ x £ 3
  x > 4 0 £ x < 1 1 £ x £ 4
  x < 2 -2 £ x £ 2 x > 2
  x < 0 x > 5 0 £ x £ 5
  0 £ x £ 3 x < 0 x > 3
  x > 4 0 £ x £ 4 x < 0

 

 

N dx
  -5   0,5
  -2   0,4
  -4    
  -8   0,4
  -3   0,3
      0,35
  -5   0,5
  -3   0,6
  -2   0,25
  -1   0,25

 

3

 

  , (-6;6), ()
  , 10, 20
  , [1;7], -2
  , 2, ()
  (), 3
  , 4,5, 1
  , (5;15)
 
  , -2
  , 3

 

 

 

 
  , 4,
 
 
  , , 4,
 
  , ,
  , 7,
 
  , , 3,

 

2

 

( ).

: (), .

. A(N,N) : , .

 

 

 

 

 


2

1

1

.

 

Sub Zadanie_1()

Const N=6

Dim A(N,N) as Integer, I as Integer, J as Integer

Dim Min as Integer, Imin as Integer, Jmin as Integer

Randomize

For I=1 To N

For J=1 To N

A(I,J) = Int(Rnd*10 5)

Cells(I,J) = A(I,J)

Next J,I

Min = 32000

For I=1 To N

For J=1 To N

If (A(I,J)<=Min) And (A(I,J) Mod 2<>0) And (I>J) Then

Min = A(I,J)

Imin = I

Jmin = J

End If

Next J,I

Cells(N+2,1) = Min =

Cells(N+2,2) = Min

Cells(N+3,1) = IMin =

Cells(N+3,2) = IMin

Cells(N+4,1) = JMin =

Cells(N+4,2) = JMin

End Sub

 

2

.

 

 

Sub Zadanie_1a()

Const N=6, M=5

Dim A(N,M) as Integer, I as Integer, J as Integer

Dim K as Integer

For I=1 To N

For J=1 To M

A(I,J) = Int(Rnd*10 5)

Cells(I,J) = A(I,J)

Next J,I

For J=1 To M

K = 0

For I=1 To N

If A(I,J) = 0 Then K = K+1

Next I

Cells(N+2,J) = K = & K J

Next J

End Sub

 

2

B(8,9) :

 

4 5 5 5 5 5 5 5 1

4 0 5 5 5 5 5 2 2

4 0 0 5 5 5 3 3 3

4 0 0 0 5 4 4 4 4

4 0 0 0 5 5 5 5 5

4 0 0 6 6 6 6 6 6

4 0 7 7 7 7 7 7 7

4 8 8 8 8 8 8 8 8

Sub Zadanie_2()

Const N = 8, M = 9

Dim B(8,9) as Integer, I as Integer, J as Integer

WorkSheets(2).Select

For I=1 To N

For J=1 To M

If I+J>M+1 Then B(I,J) = I

If (I<J) And (I+J < M+1) Then B(I,J) = 5 5

If J = 1 Then B(I,J) = 4 4

Cells(I,J) = B(I,J)

Next J,I

End Sub

 

3

3 5 h=0,3 .

 

 

Function f(x as Single) as Single -

f = (Sin(x+2))^2/(x-6)

End Function

Sub Zadanie_3()

Dim x as Single, Y as Single

WorkSheets(3).Select 3-

Cells(1,1) = X

Cells(1,2) = Y

I = 2 2

For x = -3 To 5 Step 0.3

Y = f(x)

Cells(I,1) = x x

Cells(I,2) = Y Y

I = I + 1 -

Next x

End Sub

 

 





:


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


:

:

- , - .
==> ...

1431 - | 1361 -


© 2015-2024 lektsii.org - -

: 0.116 .