Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Современный Фортран_учебник

.pdf
Скачиваний:
32
Добавлен:
23.03.2015
Размер:
1.61 Mб
Скачать

22

' # # -

! # . 5 L1, L2 – -

; a, b – . #

! ! , – +,

( ).

 

 

 

 

% 4.

&

 

 

 

 

-77

-90

#

 

 

 

 

 

! a,b

8

1

.

 

 

 

 

 

 

 

 

 

2 !

a.GT.b

a>b

2

 

 

 

 

 

&

2 !

а.GE.b

a>=b

2

 

 

 

 

" !

а.LT.b

a<b

2

 

 

 

 

 

 

 

" !

а.LE.b

a<=b

2

 

 

 

 

 

 

 

а.EQ.b

a= =b

2

 

 

 

 

 

 

0

а.NE.b

a/=b

2

 

 

 

 

 

 

 

.NOT.L1

3

 

 

 

 

 

L1.AND.L2

4

 

 

 

 

 

 

 

L1.OR.L2

5

 

 

 

 

 

 

$!

L1.EQV.L2

6

 

 

 

 

 

0 . !

L1.NEQV.L2

6

 

 

 

 

 

! "

1.' Advanced Grapher ,

http://www.alentum.com/agrapher/.

2.0 -

, $ . 0 !+ -

AGrapher . (

( ).

3.1 #, -

! ! Sind(x), Cosd(x),

Tand(x).

4. ( ! !

DO x=xn,xk,step

. . .

enddo

5 ! – , xn, xk – ! -

x, step - .

23

5. / :

 

 

 

 

 

xk xn + step

 

M = Max

0, Int

 

 

 

 

 

step

 

 

 

 

 

 

M = Max

0, Int

xk xn

+ 1

 

 

 

 

 

 

 

step

 

6.! $' ,

.

7.' , , - * , .

8.' !

! ! , .

. $'

, +* # . .

9.! ! , -

. ! ! .

10.6 – , ! ! -

# .

#

% 5 ! +* -

!. & ! – 8 ; #

# , # #. % 5. 5 ! +* !

 

 

 

 

 

 

 

 

 

:

 

 

y 2

 

 

 

 

 

 

 

 

 

 

 

 

4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

( %

A )

 

 

 

 

x

 

< 3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 +

y

2

9

( %

B )

 

 

x

 

 

 

 

 

 

 

x 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6 !, * : x [– 4, + 4],

y [– 4, + 5] .

9 x y 0,4.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

% 6. 6 # %. 5

(

)

*-

+ &

 

#

 

 

 

 

 

 

 

 

 

 

 

 

1

x = [-3, 3]

y = 4

 

2

6 !

y = 2

 

2

! .

 

 

 

 

 

 

 

 

2

y = [2, 4]

x = -3

 

2

! -

x = 3

 

2

! .

 

 

 

 

 

 

 

 

 

α [0, 360:]

x = 3cos α

 

%

'

3

Step=3

R=3

 

 

y = 3sin α

 

121

.

 

 

 

 

 

 

 

 

 

 

 

24

.1. 2-#

.

Program Region ! $

!(%, ) & $ & &

Implicit none

Real x, y

Integer alpha ! alpha- , Real(alpha)-

Integer,parameter::inside=1,outside=2 !

Logical A, B

!-------

Open(3,FILE=’3.txt’) !

Open(4,FILE=’4.txt’)

Open(5,FILE=’5.txt’)

Open(6,FILE=’6.txt’)

Open(7,FILE=’7.txt’) !

Open(inside,FILE=’in.txt’) ! $

Open(outside,FILE=’out.txt’) ! $

!------ $ (% 3 - 6) Write(3,*)-3,4; Write(3,*)3,4 !

Write(4,*)-3,2; Write(4,*)3,2 !

Write(5,*)-3,4; Write(5,*)-3,2 !

Write(6,*)3,4; Write(6,*)3,2 !

25

!------ (% 7)

Do alpha=0,360,3 ! % Sind, Cosd - ,

x=3*Cosd(real(alpha)); y=3*Sind(real(alpha))!real()- . Write(7,*)x,y;

Enddo

! Y X - $

Do x = -4, 4, 0.4 Do y = -4, 5, 0.4

A

=

y>=2 .and. y<=4 .and. abs(x)<3 ! % ,

В

=

x*x + y*y <= 9 .and. x<=0

! % !

If (A .or. B) then

Write(inside, *) x, y

Else

Write(outside, *) x, y

End If

End Do

End Do

End Program Region

$

1.- , -

? " # ! ?

2./ +

, , ?

3.' ! # ( !)

.

4.' #

.

5.9 ! .

6.5 ! # . / +

“ ” ! ON?

7.Integer :: B=27, С=3

L1=В**1/3==С

/ 3 ! L1 ( )?

.

8.- , +* ,

, ?

9.' + -#

-;

-;

-.

26

10.& 3 -

.

11.' + -# .

12.' -# #

-;

-;

-.

# ! $& !

 

1.

Do X=3.15,2.12,1.3

2.0 . 11

x tg x, x –100 –200 . ' -# . .

3.' #

Do a = 22, 9, -8

Do b = 3, 19, 11 write(*, *) a, b

enddo enddo

/ a b ?

4.( :

A = x>0; B = y<0; C = y**2<-x+1 L1 = B.or.A.and.C

& 3 # # ( ).

' + +

# # #.

5. ' # # [x, y] # #

? & . :

a);

( # #)

6.0 Y:

 

2

x 3

 

 

 

<

2 ,

 

 

9

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

 

 

 

 

 

Y =

 

 

 

 

 

 

 

< 4 ,

sec 2

 

 

 

2

 

x

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3

e x

+ 2

 

4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7. 0 -# .

 

27

 

 

a = 0

 

 

x = 2, 3, 0.2

/

 

 

 

x < 2.5

 

a = a + 2x

 

a = a + x

 

a > 10

 

 

 

.2. 2-#

% 7.

$' ! « »

7

6

7

6

1

 

2

 

 

 

 

 

3

 

4

 

 

 

 

 

 

 

 

 

 

 

28

 

 

 

 

 

 

 

7

6

7

6

 

 

 

 

 

5

 

6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7

 

8

 

 

 

 

 

 

 

 

 

 

 

9

 

10

 

 

 

 

 

11

 

12

 

 

 

 

 

 

 

 

 

 

 

13

 

14

 

 

 

 

 

 

 

 

 

 

 

 

 

29

 

 

 

 

 

 

 

7

6

7

6

 

 

 

 

 

15

 

16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

17

 

18

 

 

 

 

 

19

 

20

 

 

 

 

 

 

 

 

 

21

 

22

 

 

 

 

 

 

 

 

 

 

 

23

 

24

 

 

 

 

 

 

 

 

 

 

 

 

 

30

 

 

 

 

 

 

 

7

6

7

6

 

 

 

 

 

25

 

26

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

27

 

28

 

 

 

 

 

 

 

 

 

 

 

29

 

30

 

 

 

 

 

 

 

 

 

 

 

2.3. & -

1.! Pro1, -

x = x0 ε:

a)f(x0) ;

b)Sn(x0), ! -

%, ! ε;

c)# AGrapher:

− ! an n;

− ! Sn n;

f(x0), # n;

! ε = 10-3;

d)Out.txt ! , +: − ε;

x = x0;

f(x0), ;

31

Sn - , ;

n - ;

! f(x0) Sn.

2.*!+ AGrapher !

An.txt, Sn.txt, f.txt, Pro1.

3.! Pro2, Pro1:

a)+ ! # ;

b)! ! ( -

+ x -

!);

c)x f(x) ! xn xk

x 10 – 15 .

4.! Pro2 !+ ε:

a)! ;

b)Real - .

1.0 , ! .

2., , .

3.! ( , ,

% ! ).

4.. - +* # .

5.2-# Pro1 Pro2.

6.! Pro1.

7., # AGrapher

, Pro1.

8.# ! Pro2.

' * ! ! .

1.5 ! %:

an = a0 + a1 + a2 + ... + an + ... , ! an – $ ;

n=0

S0, S1,… Sn,… + ,

n

S0 = a0 , S1 = a0 + a1, …, Sn = ak = a0 + a1 + a2 + ... + an , …

k=0

2." , ! ! -

# S, . . lim Sn = S ,

n→∞

. S .

0 # Sn – ! .