Fortran90/95 [9]! (1 ) " " 5 "Hello!"! 3. (line) Fortran Fortran 1 2 * (1 ) 132 ( ) * 2 ( Fortran ) Fortran ,6 (continuation line) 1

Similar documents
untitled

all.dvi

情報活用資料

. p.1/15

A A p.1/16

t θ, τ, α, β S(, 0 P sin(θ P θ S x cos(θ SP = θ P (cos(θ, sin(θ sin(θ P t tan(θ θ 0 cos(θ tan(θ = sin(θ cos(θ ( 0t tan(θ

2 1 Octave Octave Window M m.m Octave Window 1.2 octave:1> a = 1 a = 1 octave:2> b = 1.23 b = octave:3> c = 3; ; % octave:4> x = pi x =

no35.dvi

1 1 Gnuplot gnuplot Windows gnuplot gp443win32.zip gnuplot binary, contrib, demo, docs, license 5 BUGS, Chang

Contents 1 Scilab

hirayama

(2000 )

70 : 20 : A B (20 ) (30 ) 50 1

Microsoft Word - Fortran2011.doc

main.dvi

2009 I 2 II III 14, 15, α β α β l 0 l l l l γ (1) γ = αβ (2) α β n n cos 2k n n π sin 2k n π k=1 k=1 3. a 0, a 1,..., a n α a

fx-260A_Users Guide_J

di-problem.dvi

untitled

1 (1) ( i ) 60 (ii) 75 (iii) 315 (2) π ( i ) (ii) π (iii) 7 12 π ( (3) r, AOB = θ 0 < θ < π ) OAB A 2 OB P ( AB ) < ( AP ) (4) 0 < θ < π 2 sin θ

, x R, f (x),, df dx : R R,, f : R R, f(x) ( ).,, f (a) d f dx (a), f (a) d3 f dx 3 (a),, f (n) (a) dn f dx n (a), f d f dx, f d3 f dx 3,, f (n) dn f

i

n 第1章 章立ての部分は、書式(PC入門大見出し)を使います

1 1 [1] ( 2,625 [2] ( 2, ( ) /

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

Microsoft Word - fortran.docx

PowerPoint Presentation

1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co

. sinh x sinh x) = e x e x = ex e x = sinh x 3) y = cosh x, y = sinh x y = e x, y = e x 6 sinhx) coshx) 4 y-axis x-axis : y = cosh x, y = s

「産業上利用することができる発明」の審査の運用指針(案)

Microsoft PowerPoint - info1-6.ppt [互換モード]

num3.dvi

GraphicsWithPlotFull.nb Plot[{( 1), ( ),...}, {( ), ( ), ( )}] Plot Plot Cos x Sin x, x, 5 Π, 5 Π, AxesLabel x, y x 1 Plot AxesLabel

Microsoft Word - 資料 (テイラー級数と数値積分).docx

. (.8.). t + t m ü(t + t) + c u(t + t) + k u(t + t) = f(t + t) () m ü f. () c u k u t + t u Taylor t 3 u(t + t) = u(t) + t! u(t) + ( t)! = u(t) + t u(

function2.pdf

No2 4 y =sinx (5) y = p sin(2x +3) (6) y = 1 tan(3x 2) (7) y =cos 2 (4x +5) (8) y = cos x 1+sinx 5 (1) y =sinx cos x 6 f(x) = sin(sin x) f 0 (π) (2) y

OABC OA OC 4, OB, AOB BOC COA 60 OA a OB b OC c () AB AC () ABC D OD ABC OD OA + p AB + q AC p q () OABC 4 f(x) + x ( ), () y f(x) P l 4 () y f(x) l P

num2.dvi

04.dvi

08 p Boltzmann I P ( ) principle of equal probability P ( ) g ( )g ( 0 ) (4 89) (4 88) eq II 0 g ( 0 ) 0 eq Taylor eq (4 90) g P ( ) g ( ) g ( 0

生活設計レジメ

44 4 I (1) ( ) (10 15 ) ( 17 ) ( 3 1 ) (2)

I II III 28 29



III No (i) (ii) (iii) (iv) (v) (vi) x 2 3xy + 2 lim. (x,y) (1,0) x 2 + y 2 lim (x,y) (0,0) lim (x,y) (0,0) lim (x,y) (0,0) 5x 2 y x 2 + y 2. xy x2 + y


Chap10.dvi

DVIOUT-講

PowerPoint プレゼンテーション

数値計算

untitled

(2-1) x, m, 2 N(m, 2 ) x REAL*8 FUNCTION NRMDST (X, M, V) X,M,V REAL*8 x, m, 2 X X N(0,1) f(x) standard-norm.txt normdist1.f x=0, 0.31, 0.5

Microsoft Word - 03-数値計算の基礎.docx

解きながら学ぶC++入門編

2014 S hara/lectures/lectures-j.html r 1 S phone: ,

高等学校学習指導要領

高等学校学習指導要領

解きながら学ぶC言語

USB ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

N88 BASIC 0.3 C: My Documents 0.6: 0.3: (R) (G) : enterreturn : (F) BA- SIC.bas 0.8: (V) 0.9: 0.5:

untitled

OHP.dvi

コンピュータ概論

gnuplot gnuplot 1 3 y = x 3 + 3x 2 2 y = sin x sin(x) x*x*x+3*x*x

x () g(x) = f(t) dt f(x), F (x) 3x () g(x) g (x) f(x), F (x) (3) h(x) = x 3x tf(t) dt.9 = {(x, y) ; x, y, x + y } f(x, y) = xy( x y). h (x) f(x), F (x

18 ( ) I II III A B C(100 ) 1, 2, 3, 5 I II A B (100 ) 1, 2, 3 I II A B (80 ) 6 8 I II III A B C(80 ) 1 n (1 + x) n (1) n C 1 + n C

45 VBA Fortran, Pascal, C Windows OS Excel VBA Visual Basic Excel VBA VBA Visual Basic For Application Microsoft Office Office Excel VBA VBA Excel Acc

fx-370ES_912ES_UsersGuide_J02

40 6 y mx x, y 0, 0 x 0. x,y 0,0 y x + y x 0 mx x + mx m + m m 7 sin y x, x x sin y x x. x sin y x,y 0,0 x 0. 8 x r cos θ y r sin θ x, y 0, 0, r 0. x,

gnuplot.dvi

さくらの個別指導 ( さくら教育研究所 ) A a 1 a 2 a 3 a n {a n } a 1 a n n n 1 n n 0 a n = 1 n 1 n n O n {a n } n a n α {a n } α {a

PowerPoint プレゼンテーション

1 8, : 8.1 1, 2 z = ax + by + c ax by + z c = a b +1 x y z c = 0, (0, 0, c), n = ( a, b, 1). f = n i=1 a ii x 2 i + i<j 2a ij x i x j = ( x, A x), f =

卒 業 研 究 報 告.PDF

ohp1.dvi

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 初版 1 刷発行時のものです.

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

fx-3650P_fx-3950P_J

Chapter 3 Mathematica Mathematica e ( a n = ) n b n = n 1! + 1 2! n! b n a n e 3/n b n e 2/n! b n a n b n Mathematica Mat

2009 IA 5 I 22, 23, 24, 25, 26, (1) Arcsin 1 ( 2 (4) Arccos 1 ) 2 3 (2) Arcsin( 1) (3) Arccos 2 (5) Arctan 1 (6) Arctan ( 3 ) 3 2. n (1) ta

情報活用資料

kiso2-06.key

2.2 h h l L h L = l cot h (1) (1) L l L l l = L tan h (2) (2) L l 2 l 3 h 2.3 a h a h (a, h)

( ) 2.1. C. (1) x 4 dx = 1 5 x5 + C 1 (2) x dx = x 2 dx = x 1 + C = 1 2 x + C xdx (3) = x dx = 3 x C (4) (x + 1) 3 dx = (x 3 + 3x 2 + 3x +

1 [ 1] (1) MKS? (2) MKS? [ 2] (1) (42.195k) k 2 (2) (3) k/hr [ 3] t = 0 10 ( 1 velocity [/s] 8 4 O

D xy D (x, y) z = f(x, y) f D (2 ) (x, y, z) f R z = 1 x 2 y 2 {(x, y); x 2 +y 2 1} x 2 +y 2 +z 2 = 1 1 z (x, y) R 2 z = x 2 y

数学の基礎訓練I

[ ] x f(x) F = f(x) F(x) f(x) f(x) f(x)dx A p.2/29

卒論 提出用ファイル.doc

新版 明解C++入門編

, 1 ( f n (x))dx d dx ( f n (x)) 1 f n (x)dx d dx f n(x) lim f n (x) = [, 1] x f n (x) = n x x 1 f n (x) = x f n (x) = x 1 x n n f n(x) = [, 1] f n (x

(1) (2) (3) (4) HB B ( ) (5) (6) (7) 40 (8) (9) (10)

2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa

演習1

I

1 1.1 [ 1] velocity [/s] 8 4 (1) MKS? (2) MKS? 1.2 [ 2] (1) (42.195k) k 2 (2) (3) k/hr [ 3] t = 0

y = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f() + f() + f(3) + f(4) () *4

S I. dy fx x fx y fx + C 3 C vt dy fx 4 x, y dy yt gt + Ct + C dt v e kt xt v e kt + C k x v k + C C xt v k 3 r r + dr e kt S Sr πr dt d v } dt k e kt

Transcription:

Fortran90/95 2.1 Fortran 2-1 Hello! 1 program example2_01! end program 2! first test program ( ) 3 implicit none! 4 5 write(*,*) "Hello!"! write Hello! 6 7 stop! 8 end program example2_01 1 program 1! Plato3 Terapad NotePad 1. (statement) Fortran 5 write Hello! 1 ( ) Plato3 Gnome editor example2_1 (2 ) "Hello!" Fortran ( ) 2. (comment) Fortran - 10 -

Fortran90/95 [9]! (1 ) " " 5 "Hello!"! 3. (line) Fortran Fortran 1 2 * 1 1 1 132 (1 ) 132 ( ) * 2 ( Fortran ) Fortran 1 1 2 4,6 (continuation line) 1 132 & *3 & & & write(*,*) "AAAAAAA& &BBBBBB" *1 Fortran *2 Windows SJIS 2 Fedora utf8 3 *3-11 -

Fortran90/95 write(*,*) "AAAAAAABBBBBB" & 39 1 ; ( ) 2 *4 a = 0 ; b = 0 4. Fortran Fortran (i) 26 ( ) 0 9 _ 63 Fortran write Write * 5 (ii) + - * / = ( )., : $! " % & ; > <? 21 (iii) @ { 2-1 example2_1 Fortran 31 31 OS (Fortran (3) ) 1 Fortran (1) a-b (2) CO2 (3) _stdout (4) a.out (5) 2d (6) o_1 (7) ( ) (2) (6) *4 *5 Windows Linux - 12 -

Fortran90/95 2.2 1. 2-2 12 + 3 15 1 program example2_02 2 implicit none 3 4 write(*,*) 12 + 3 5 6 stop 7 end program example2_02 2-2 4 12 3 1234567 1 234 567 * 6 12 3 "Hello" * 7 4 + (operator) + (operand) ( ) 1 +5 12 + 5 12+5 12 + 5 (expression) 12 + 3 (numeric experssion) "Hello" (character expression) ( ) *6 FORTRAN77 *7-13 -

Fortran90/95 2. 2-3 4 2 ( ) 4 + 2 ( ) 4 2 ( ) 4 2 ( ) 4/2 ( ) 4 2 Fortran 5 (i) + * 8 (ii) - ( ) (iii) * (iv) / * 9 (v) ** 1 program example2_03 2 implicit none 3 4 write(*,*) 4 + 2 5 write(*,*) 4-2 6 write(*,*) 4*2 7 write(*,*) 4/2 8 write(*,*) 4**2 9 10 stop 11 end program example2_03 2-3 3. 2-4 24 (1) 4 + 2 3 (2) 2 4 (3) 1 2 (4) 3 5 (5) 4 23 (6) 2 32 (1) Fortran 4 + 2*3 ( ) 4 + 2 * 3 4+2*3 4+2 * 3 (2) 24/2*4 24/2/4 24/(2*4) *8 *9-14 -

Fortran90/95 (3) - - -1-2 1 2 1 2 (4) * - -3*-5 *- * 10 *(-5) 3 (5) 4*2**3 4*(2**3) (6) 2**3**2 (2 3 ) 2 = 8 2 = 64 2 (32) = 2 9 = 512 2**(3**2) (2**3)**2 Appendix 1 1 program example2_04 2 implicit none 3 4 write(*,*) 4 + 2*3 5 write(*,*) 24/(2*4) 6 write(*,*) -1-2 7 write(*,*) (-3)*(-5) 8 write(*,*) 4*(2**3) 9 write(*,*) 2**(3**2) 10 11 stop 12 end program example2_04 2-4 2 Fortran 6 (1) (1 + 3) (2 4) (2) 1 + 2 (3) 23 3 2 (1) (1+3)*(2-4) (2) 6/(1+2) (3) (2**3)*(3**2) *10 (-5) - 15 -

Fortran90/95 2.3 1. 2-5 ( ) 7 3 (1) (2) (3) Fortran 1,2,3, 0, 1, 2, (2 16 ) (integer data type) (real data type) * 11 32 10 * 12 12 0-45 +5 32 10 6 7 10 30 10 30 + 0.0 11.3-5.2 4. -.25 0. ( ) e + 1.2e3 -.2e-2 1e0-2e-3 e 10 e 1e-4 1 10 4 = 0.0001 10e3 10 10 3 = 10000 * 13 *11 *12 2 31 < = ( ) < = 2 31 1 *13 e 1 e3-16 -

Fortran90/95 1 program example2_05 2 implicit none 3 4 write(*,*) 7/3 5 write(*,*) 7-7/3*3 6 write(*,*) 7.0/3.0 7 8 stop 9 end program example2_05 2-5 Fortran (-7)/(-3) 2 7/(-3) 2 (-7)/3 2 6 1 * 14 2. 2-6 1.5 4 3 Fortran (1) 1.5*4/3 (2) 4/3*1.5 ( ) * 15 Fortran (1) 1.5*4 6.0 6.0/3 2.0 (2) 4/3 1 1*1.5 1.5 ( 1.5*4.0/3.0 4.0/3.0*1.5 ) *14 *15-17 -

Fortran90/95 3. 2-7 5 5 "Hello" (character data type) 5 5 write 1 program example2_07 2 implicit none 3 4 write(*,*) 5 5 write(*,*) "5" 6 7 stop 8 end program example2_07 2-7 (character string) 1 (character expression) " " * 16 ( ) * 17 // 2 "ab"// cde "abcde" 1 3 Fortran (1) 4 5 3 2 (2) 27 1 3 (1) (4.0*5.0)/(3.0*2.0) 3.3333 (2) 27.0**(1.0/3.0) 3.0 *16 Ruby " *17-18 -

Fortran90/95 2.4 1. 2-8 x x x 2 x 3 x 4 x = 2 2.0 2.0**2 2.0**3 2.0**4 x (variable) ( ) Fortran (i) (ii) (iii) 2-8 1 program example2_08 2 3 implicit none 4 real :: x! 5 6 x = 2.0! 7 write(*,*) x 8 write(*,*) x**2 9 write(*,*) x**3 10 write(*,*) x**4 11 12 stop 13 end program example2_08 x = 2.0 3 (type declaration statement) (declaration statement) x 1 * 18 :: (type specifier) :: ( ) integer ( ) real ( ) character(len=nn) *18-19 -

Fortran90/95 nn ( ) len= character(12) * 19 Fortran ( 31 ) * 20, real :: x real :: y 2 real :: x, y x 7 write * 21 2. 5 x 2.0 (assignment statement) = = x+1=y <- * 22 3. 2-8 4 6 real :: x = 2.0 (initialization expression) :: =, =... g c π *19 *20 ( ) *21 FORTRAN77 *22 ALGOL PASCAL = := = - 20 -

Fortran90/95 real, parameter :: pai = 3.14159265 parameter pai parameter (attibute) parameter (named constant), parameter :: =, = =... pai 3.14159265 integer, parameter :: n = 10 integer, parameter :: n2 = n * 2 4. 2-9 (1) a b h Fortran (2) a = 1 b = 2 h = 1.5 * x y xy xy 2-9 1 program example2_09 2 implicit none 3 real :: a = 1.0, b = 2.0, h = 1.5! 4 5 write(*,*) (a+b)*h/2.0 6 7 stop 8 end program example2_09 5. 2-10 (1) x 1234567890 (2) k 2.8-21 -

Fortran90/95 (...) (1) (6 7 ) 1.234568 10 9 (2) 2-10 1 program example2_10 2 implicit none 3 real :: x 4 integer :: k 5 6 x = 1234567890! 7 write(*,*) x 8 k = 2.8 9 write(*,*) k! 10 11 stop 12 end program example2_10 4 Fortran (1) x(y + z) (2) a + b 2 (3) 1 t + 1 (1) x*(y+z) (2) a + b/2.0 (3) 1.0/(t+1.0) - 22 -

Fortran90/95 2.5 1. read write 2-11 4 x 1 x 2 x 3 x 4 1 read read(*,*) 1, 2, 3... write write(*,*) 1, 2, 3... 2-11 1 program example2_11 2 implicit none 3 real :: x1, x2, x3, x4 4 5 read(*,*) x1, x2, x3, x4! 6 write(*,*) x1, x2, x3, x4! 7 write(*,*) "sum=", x1 + x2 + x3 + x4 8 9 stop 10 end program example2_11 read write write(*,*) "y=", y read write (*,*), 1 * (i) read(*,.. * PC (ii) write(*,.. * PC * 23 read write, 2 * (list-directed input / output) Fortran (*,*) * * *23-23 -

Fortran90/95 2. 2-11 5 (i) (ii) (iii) (iv) (v) (separator) Enter 1 1, 2 1 2 3 4 1.0,2.0, 3.0, 4.0 (i) read Fortran * 24 (ii) 5 6 8 9.2! 4 9.2 * 25 (i) 1 ( ) (ii) cntl-c / (i), / " (ii) " " (iii) 1 "ab cd""ef" ab cd"ef *24 Fortran *25! - 24 -

Fortran90/95 3. (i) 1 (ii) 1 (iii) 1 (i) 1 (ii) 1 (iii) 1 4. * 26 ctrl-c * 27 (i) xxx.txt (ii) abc.f90 read(*,*) var1, var2,... (iii) 1 (iv) (v) (Linux )./a.out < xxx.txt (Windows ) abc.exe < xxx.txt xxx.txt (i) def.f90 write(*,*) expression1, expression2,... (ii) *26 Fortran OS *27 1 1 open - 25 -

Fortran90/95 (iii) (iv) (Linux )./a.out > zzz.txt (Windows ) def.exe > zzz.txt zzz.txt write(*,*) "x " x zzz.txt 5 program main implicit none integer :: i1, i2, i3, i4 read(*,*) i1 read(*,*) i2, i3 read(*,*) i4 write(*,*) i1, i2, i3, i4 stop end program main 1, 2 3 4, 5 6, 7 i1,i2,i3,i4 i1 1 i2 3 i3 4 i4 6-26 -

Fortran90/95 2.6 1. f (x) (function) (i) (intrinsic function) Fortran95 100 * 28 (ii) (i) Fortran f (x) f x (argument) (ii) ( 1[, 2][, 3],...) (iii) (iv) 2. 2-12 x (1) x (2) x (3) x (4) x Fortran x < 2 31 1 x = 2.5 int(x) x x aint(x) nint(x) x x anint(x) floor(x) x x ceiling(x) x x *28 [3][4][5][8] - 27 -

Fortran90/95 2-12 1 program example2_11 2 implicit none 3 real :: x 4 5 x = -2.5 6 write(*,*) int(x) 7 write(*,*) nint(x) 8 write(*,*) floor(x) 9 write(*,*) ceiling(x) 10 11 stop 12 end program example2_11 real(x) x x (numeric function) 5 abs(x) x x mod(n,m) n m n m n max(x1,x2[,x3]...) x1,x2,... x1,x2,... 2 min(x1,x2[,x3]...) x1,x2,... x1,x2,... 2 aimag( ) cmplx( ) conjg( ) dble( ) dim( ) dprod( ) modulo( )) sign( ) 3. 2-13 x y (1) x 2 + 1 (2) e x y (3) log(x + y) (4) sinx (5) arctanx Fortran x = 1.0 y = 0.5-28 -

Fortran90/95 Fortan (mathematical function) * 29 sqrt(x) x x x < 0 exp(x) e x log(x) e log e x x < 0 log10(x) 10 log 10 x x < 0 sin(x) sinx x cos(x) cosx x tan(x) tanx x asin(x) arcsinx x < = 1 π/2 < = < = π/2 acos(x) arccosx x < = 1 0 < = < = π atan(x) arctanx π/2 < < π/2 atan2(y,x) (x,y) x x π < < = π x y 0 sinh(x) sinhx = ex e x 2 cosh(x) coshx = ex + e x 2 tanh(x) tanhx = ex e x e x + e x 2-13 1 program example2_12 2 implicit none 3 real :: x, y 4 5 x = 1.0 6 y = 0.5 7 write(*,*) sqrt(x*x + 1.0) 8 write(*,*) exp(x-y) 9 write(*,*) log(x+y) 10 write(*,*) sin(x) 11 write(*,*) atan(x) 12 *29 sqrt exp log sin cos - 29 -

Fortran90/95 13 stop 14 end program example2_12 4. (i) ( ) ( ) sqrt(abs(-y)) (ii) ( ) real :: sin (iii) sin cos tan π 6 Fortran a + 1 (1) a = 2 log e a 1 (2) t = π 4 sin t + cos 2t (3) (x,y) = ( 1 2, 3 2 ) (1) log(abs((a+1.0)/(a-1.0)))=-1.09861 (2) sin(t) + cos(2.0*t)=0.707107 (3) sqrt(x*x+y*y)=1.00000 atan2(y,x)=2.09440-30 -

Fortran90/95 2-1 2 Fortran x = 1 (1) x 3 + 2x 2 + 2x + 1 (2) 1 + cos2x 2 2-2 (3) 1 2π e x2 /2 r 3 4 π r3 4π r 2 2-3 x 2 2-4 (1) (h) (m) (s) (t) 0 < = h < 24 0 < = m < 60 0 < = s < 60 (2) (t) 0 < = t < 86400 2-5 1000 5% 1 2-6 A(1.0,1.0) B(5.0,3.0) C(4.0,5.0) 1 (x,y) 1.0,1.0 5.0,3.0 4.0,5.0 (1) a,b,c a= b= c= (2) S = s(s a)(s b)(s c) s = a + b + c 2 ABC S ( ) (0.0,0.0) (3.0,0.0) (0.0,4.0) - 31 -