joho12.ppt

Similar documents

joho09.ppt

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

C言語によるアルゴリズムとデータ構造

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

QR

Gauss

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

コンピュータ概論

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

c-all.dvi

A

P05.ppt

sim98-8.dvi


1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B


TEX American Mathematical Society PostScript Adobe Systems Incorporated

#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main

新版明解C言語入門編

P02.ppt

ex14.dvi

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL 2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)

超初心者用

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

PowerPoint Presentation

/

XMPによる並列化実装2

Intel® Compilers Professional Editions

p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 +

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

‚æ4›ñ

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

main.dvi

新・明解C言語 実践編

問 2 ( 型変換 ) 次のプログラムを実行しても正しい結果が得られない 何が間違いかを指摘し 正しく修正せよ ただし int サイズが 2 バイト long サイズが 4 バイトの処理系での演算を仮定する #include <stdio.h> int main( void ) { int a =

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

all.dvi

C言語入門

all.dvi

1 0/1, a/b/c/ {0, 1} S = {s 1, s 2,..., s q } S x = X 1 X 2 X 3 X n S (n = 1, 2, 3,...) n n s i P (X n = s i ) X m (m < n) P (X n = s i X n 1 = s j )

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

Copyright Oracle Parkway, Redwood City, CA U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated softw

syspro-0405.ppt

:30 12:00 I. I VI II. III. IV. a d V. VI

ープのロープ長以下であれば実現可能である ケース 3: 3 本のロープの杭の位置を点 P 1 = (x 1, y 1, 0), 点 P 2 = (x 2, y 2, 0), 点 P 3 = (x 3, y 3, 0) とする 点 P 1 = (x 1, y 1, 0), 点 P 2 = (x 2,

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

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

x(t) + t f(t, x) = x(t) + x (t) t x t Tayler x(t + t) = x(t) + x (t) t + 1 2! x (t) t ! x (t) t 3 + (15) Eular x t Teyler 1 Eular 2 Runge-Kutta

Appendix A BASIC BASIC Beginner s All-purpose Symbolic Instruction Code FORTRAN COBOL C JAVA PASCAL (NEC N88-BASIC Windows BASIC (1) (2) ( ) BASIC BAS

ii

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

comment.dvi

Microsoft PowerPoint - 説明2_演算と型(C_guide2)【2015新教材対応確認済み】.pptx

資料

第1章

解きながら学ぶC言語

/* sansu1.c */ #include <stdio.h> main() { int a, b, c; /* a, b, c */ a = 200; b = 1300; /* a 200 */ /* b 200 */ c = a + b; /* a b c */ }

untitled

10

program.dvi

I J

スライド 1

行列代数2010A

C言語による数値計算プログラミング演習

11042 計算機言語7回目 サポートページ:

newmain.dvi

スライド 1

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

para02-2.dvi

programmingII2019-v01

新版明解C言語 実践編

スライド 1

kiso2-09.key

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

1: *2 W, L 2 1 (WWL) 4 5 (WWL) W (WWL) L W (WWL) L L 1 2, 1 4, , 1 4 (cf. [4]) 2: 2 3 * , , = , 1

数値計算法

Cプログラミング - 第8回 構造体と再帰

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 =

AutoTuned-RB

1 1.1 (JCPRG) 30 Nuclear Reaction Data File (NRDF) PC GSYS2.4 JCPRG GSYS2.4 Java Windows, Linux, Max OS X, FreeBSD GUI PNG, GIF, JPEG X Y GSYS2

1

tuat1.dvi

joho07-1.ppt

lexex.dvi

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

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

ゲームエンジンの構成要素

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

1. 1 BASIC PC BASIC BASIC BASIC Fortran WS PC (1.3) 1 + x 1 x = x = (1.1) 1 + x = (1.2) 1 + x 1 = (1.

( ) 1.1 Polychoric Correlation Polyserial Correlation Graded Response Model Partial Credit Model Tetrachoric Correlation ( ) 2 x y x y s r 1 x 2

Microsoft Word - C.....u.K...doc

卒 業 研 究 報 告.PDF

1. ファイルにアクセスするには ファイルにアクセスするには 1. ファイルを開く 2. アクセスする 3. ファイルを閉じるという手順を踏まなければなりません 1.1. ファイルを読み込む まずはファイルの内容を画面に表示させるプログラムを作りましょう 開始 FILE *fp char fname

Transcription:

n φ 1 (x),φ 2 (x),,φ n (x) (x i, f i ) Q n c 1,,c n (,f k ) q n = c i φ i (x) x Q n i=1 c 1 = 0 c 1 n ( c 1 ) = q n f k 2

Q n ( c 1 ) = q 2 2 n ( ) 2 f k q n ( ) + f k Q n c 1 = c 1 q n 2 q n( ) q n q 2 f n k c i c i q n( ) = 2q n q n c i c i q 2 f n k c i c i q = f n,,c n k c i φ 2 1 ( ) φ 1 ( )φ 2 ( ) φ 1 ( )φ n x k φ 2 ( )φ 1 ( ) φ 2 2 ( ) φ 2 ( )φ n x k φ n ( )φ 1 ( ) φ n ( )φ 2 ( ) φ 2 n ( ) = φ i c 1 c 2 = c n f k φ 1 f k φ 2 f k φ n

x n q n = c i φ i (x) x n 1 x k x k 2 n x k x k x k n = x i 1 (i =1,2,, ) i=1 c 1 c 2 = n 1 n 2(n 1) x k x k c n n 1 f k x k Gauss-Jordan c 1,,c n f k f k

n 1 n x k c n n 1 f k x k (-2, -3), (-1, 2), (0, 1) n 1 x k x k c 1 2 n x k x k x k c 2 = 2(n 1) n 1 3 x k x k n 1 2(n 1) x k x k Gauss-Jordan c 1 =1, c 2 =-4, c 3 =-3 c 1 c 2 c 3 f k f k 3+ 2 +1 = 3 2 + 2 1+1 0 3 ( 2) 2 + 2 1 2 +1 ( 0) 2 0 = 4 10

12-2.c floating XY 4 fitting /* average error, standard deviation */ /* */ #include <stdio.h> #include <ath.h> #define N 5 /* 5x5 atrix*/ #define MAX 10000 /* data ax size */ stdio.h Sqrt ath.h include Fitting N 5 x 4 10 9 MAX MAX a[][] N d[2][] XY int ain(void){ double a[n][n+1]; double d[2][max]; double p, dd, f=0.0, err=0.0, ave_err, std_err1, std_err2; int i=0, j, k, ; i, j, k, /* ctrl + d EOF */ while ( (scanf("%lf %lf", &d[0][i], &d[1][i]))!= EOF ){i++; scanf EOF (End Of File) d[0][i], d[1][i] EOF while loop

12-2.c /* ake aterix */ = i ; /* nuber of data set, nubering fro 1 */ /* siga x */ for (i=0; i<n; i++){ for (j=0; j<n; j++){ for (k=0; k<; k++){ /* calculate atrix eleent */ a[i][j] += pow(d[0][k], ((i+j)*1.0)); a[0][0] = *1.0; /* cast to double */ for (i=0; i<n; i++){ for (k=0; k<; k++){ /* calculate RHS eleent */ a[i][n] += d[1][k] * pow(d[0][k], i*1.0); loop i Loop 0 =i pow(a, b) a b (i+j)*1.0 double a[i][j] Σ i+j k *1.0 int double a[][] Cast (double) AX=B A B Gauss-Jordan

12-2.c /* ---- Gauss-Jordan ethod ---- */ for (k=0; k<n; k++){ p = a[k][k]; for (j=k; j<n+1; j++){ a[k][j]=a[k][j]/p; for (i=0; i<n; i++){ if (i!=k){ dd = a[i][k]; for (j=k; j<n+1; j++){ a[i][j]=a[i][j]-dd*a[k][j]; /* substract pivot gyou by p */ /* pivot sweep out */ Gauss-Jordan 11-1

12-2.c /* calculate average error and std error */ for (k=0; k<; k++){ f = 0.0; /* evaluate fitting function */ Fitting for (i=0; i<n; i++){ a[][] f += a[i][n]* pow(d[0][k], i*1.0); Fitting su su err += d[1][k] - f; /* su error */ std_err2 += (f - d[1][k])*(f - d[1][k]); /* su error square */ ave_err = err/; /* evaluate average error */ std_err1 = sqrt( std_err2/ ); /* evaluate std error */ /* ---- out put solution ---- */ for (k=0; k<n; k++){ printf("c%d= %lf n", k, a[k][n]); printf("ave_error= %g t nstd_error= %g n", ave_err, std_err1); return (0);

xy01.txt fitting 1. Excel xy01.txt 2. fitting./12-2 < xy01.txt 3. fitting Excel y = c0 + c1*x +c2*x*x + c3*x*x*x + c4*x*x*x*x f(x) 25 20 15 10 5 0-5 -10 Least square ethod: data fitting xy01.txt xy01.txt data fitting line -15-3 -2-1 0 1 2 3 x fitting paraeter: c0=2.620474, c1=0.305564, c2=-8.860936, c3=-0.010951, c4=1.789889 ave_err= 4.82403e-15 std_err= 2.93794 http://extree.phys.sci.kobe-u.ac.jp/staffs/okubo/lectures/prograing/joho12/xy01.txt

soothing Y 40 30 20 10 0 Data (+noise) intrinsic data -10 1 1.5 2 2.5 3 X

12-3.c N /* Idou Heikin */ #include <stdio.h> #include <ath.h> #define N 5 /* heikin ryou */ #define MAX 10000 /* data ax size */ int ain(void){ double d[2][max]; double ave; int i, j, ; /* ctrl + d EOF */ while ( (scanf("%lf %lf", &d[0][i], &d[1][i]))!= EOF ){i++; =i; /* nuber of data set, nubering fro 1 */ for (i=(n-1); i<; i++){ ave = 0.0; for (j=0; j<n; j++){ ave += d[1][j+i-n+1]; ave = ave/n; printf("%lf %lf n", d[0][i], ave); return (0);

xy02.txt soothing./12-3 < xy02.txt > xy02s.txt xy02s.txt 200 150 100 original sooth 5 Sooth 10 xy02.txt Y 50 0-50 -100-3 -2-1 0 1 2 3 4 5 x http://extree.phys.sci.kobe-u.ac.jp/staffs/okubo/lectures/prograing/joho12/xy02.txt

C Unix script

12-2 fitting 12-3 soothing fitting A. 12-3 (tp.dat) 12-2./12-3 < xy02.txt > tp.dat./12-2 < tp.dat B. tp.dat./12-3 < xy02.txt./12-2 -./12-3 < xy02.txt -./12-3./12-2 UNIX

UNIX shell MS-DOS DOS-shell UNIX shell shell Bourne shell, C shell, Korn shell shell OSX tiger Bourne shell bash bash shell shell script

Mac CR UNIX LF UNIX script LF ac2unix.sh LF(UNIX) #!/bin/sh # CR => LF (Mac => Unix) # Usage:./ac2unix.sh src.txt > dest.txt tr ' r' ' n' < $1 chod u+x ac2unix.sh unix2ac.sh LF #!/bin/sh # LF => CR (Unix => Mac) # Usage:./unix2ac src.txt > dest.txt tr ' n' ' r' < $1 \

ac2unix.sh unix2ac.sh ac2unix.sh [ ] > [ ] Mac (CR) -> UNIX (LF) unix2ac.sh path $HOME/joho-shori/ac2unix.sh

.zip nuber 0.jpeg 9.jpeg http://extree.phys.sci.kobe-u.ac.jp/staffs/okubo/lectures/prograing/nuber.zip A. nuber ls 0.jpeg 3.jpeg 6.jpeg 9.jpeg 1.jpeg 4.jpeg 7.jpeg 2.jpeg 5.jpeg 8.jpeg.jpeg for fnae in *.jpeg > do jpeg > v $fnae ${fnae%.jpeg.jpg > done ls 0.jpg 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg 6.jpg 7.jpg 8.jpg 9.jpg

jpg jpeg B. shell script i ren.sh UNIX LF #!/bin/bash for fnae in `ls *.jpeg` do v $fnae ${fnae%.jpeg.jpg done chod u+x ren.sh ls -l ren.sh -rwxr--r-- 1 okubo okubo 69 19 6 12:26 ren.sh nuber./ren.sh ls 0.jpg 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg 6.jpg 7.jpg 8.jpg 9.jpg