$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena

Size: px
Start display at page:

Download "$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena"

Transcription

1 $ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a

2 $ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filename> less $ man <cmdname> <cmdname> $ mkdir <dirname> <dirname>

3 nrps ~ nrps ~/nrps $ cd ~/nrps nrps hello.c.c ~/nrps hello.c /* This is my first C program. */ #include<stdio.h> #define MYNAME "abcdefg" int main() { printf("hello World!!\n"); printf("my name is %s.\n",myname); return(0); }

4 hello.c hello.c ~/nrps $ cd ~/nrps nrps $ ls-a $ gcc hello.c -o hello.out -lm hello.c hello.out hello.out aaa.out aaa.out $ ls hello.out $./hello.out hello.c gcc... c ~/nrps

5 $ cd ~/nrps $ chmod +x c $ cd ~/nrps $./c hello hello.c hello.out ~/nrps ~/nrps $ cd~/nrps cd $ ls -a $ rm -r <file name> $ ls -a

6 main2d.c ~/nrps main2d.c $ cd ~/nrps $./c main2d $./main2d.out 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 5 #define WIDTH #define HIGHT void display(void); 9 void reshape(int w, int h); 10 void keyboard(unsigned char key, int x, int y); 11 void ginit(int* pargc, char** argv); void display(void) 14 { 15 int i, j; glclear(gl_color_buffer_bit); 18 glpointsize(1);

7 19 glbegin(gl_points); 20 glcolor3f(1.0,0.0,0.0); /* red */ 21 glvertex2f(1,1); 22 glcolor3f(0.0,1.0,0.0); /* green */ 23 glvertex2f(2,2); 24 glcolor3f(0.0,0.0,1.0); /* blue */ 25 glvertex2f(3,3); glend(); 28 glutswapbuffers(); 29 } void reshape(int w, int h) 32 { 33 glviewport(0, 0, (GLsizei)w, (GLsizei)h ); 34 glmatrixmode(gl_projection); 35 glloadidentity(); 36 gluortho2d(0.0, (GLdouble)w, 0.0, (GLdouble) h); 37 } void keyboard(unsigned char key, int x, int y) 40 { 41 switch(key) { 42 case 'q': 43 case 'Q': 44 exit(0); 45 break; 46 case ' ': 47 glutidlefunc(0); 48 break; 49 default: 50 break; 51 } 52 }

8 53 54 void ginit(int* pargc, char** argv) 55 { 56 glutinit(pargc,argv); 57 glutinitdisplaymode(glut_double GLUT_RGB); 58 glutinitwindowsize(width,hight); 59 glutinitwindowposition(100,50); 60 glutcreatewindow("numerical Recipes for Polymer Science"); 61 glclearcolor(0.0,0.0,0.0,0.0); /* background color */ 62 glshademodel(gl_flat); 63 glutdisplayfunc(display); 64 glutreshapefunc(reshape); 65 glutkeyboardfunc(keyboard); 66 } int main(int argc, char* argv[]) 69 { 70 ginit(&argc,argv); 71 glutmainloop(); 72 return 0; 73 } WIDTH HIGHT WIDTH 300 reshape void int

9 display glutdisplayfunc(display) display i j display() 1 glbegin() glend() glbegin(gl_points) glbegin(gl_lines) glbegin(gl_line_strip) glbegin(gl_line_loop) glbegin(gl_triangles / GL_QUADS) glbegin(gl_trianble_strip / GL_QUAD_STRIPE) glbegin(gl_triangle_fan) glbegin(gl_polygon) glcolor3f() glvertex2f(float x, float y) (x, y) glutswapbuffers() reshape(int w, int h) glutreshapefunc() glutkeyboardfunc()

10 ginit(int* pargc, char** argv) main() main() { } #include.c ;

11 #include <stdio.h> int main() { printf("hello World!\n"); return(0); } #include <stdio.h> int main(){printf("hello World!\n");return(0);} main() #include <stdio.h> int mai n(){printf("hello World!\n");return(0);} ; : {} () [] <> #include '' "" / % { } _ _

12 + a = b+c; b c a - a = b-c; b c a * a = b*c; b c a / a = b/c; b c a % a = b%c; b c a ++ a++; ++a; a = a + 1; -- a--; --a; a = a - 1; - b = -a;

13 = a = b += a += b; a = a + b; -= a -= b; a = a - b; *= a *= b; a = a*b; /= a /= b; a = a/b; %= a %= b; a = a%b; > < >= <= ==!= a = (b > c); c b a a a = ( b!= c); b c a a a = (b > c) && (c < d); b>c c<d a a = (b > c) (c < d); b>c c<d a &&!

14 a =!(b > c); b>c a if for while 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 int num,i; 7 8 for(i=0;i<4;i++){ 9 num = rand()%2000; if(num < 100){ 12 printf("%d < 100\n", num); 13 }else if(num > 1000){ 14 printf("%d > 1000\n", num); 15 }else{ 16 printf("100 <= %d <= 1000\n",num); 17 } if(num < 100)printf("The num is smaller than 100\n"); } i=0;

15 24 while(i < 5){ 25 num = rand()%2000; 26 printf("num = %d\n",num); 27 i++; 28 } do{ 31 num = rand()%2000; 32 printf("in do_while, num = %d\n",num); 33 i--; 34 }while(i>0); return(0); 37 } 38.c 1 #include <stdio.h>

16 2 #include <stdlib.h> 3 4 double f2bai(double x); 5 double tasu(double x, double y); 6 7 double f2bai(double x) 8 { 9 printf("f2bai works.\n"); return(2.0*x); 12 } double tasu(double x, double y) 15 { 16 return(x+y); 17 } int main() 20 { 21 double a,b; a = (rand()%1000)/1000.0; 24 b = (rand()%1000)/1000.0; printf("2*%lf = %lf\n", a, f2bai(a)); 27 printf("%lf + %lf = %lf\n", a, b, tasu(a,b)); return(0); 30 } ~/nrps

17 $ pwd main2d.c hexagon.c $ cp main2d.c hexagon.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> * 4 #include <math.h> 5 6 #define WIDTH #define HIGHT 300 * 8 #define RADIUS 100 * 9 #define X0 150 *10 #define Y void display(void) 18 { *19 int x, y, deg; glclear(gl_color_buffer_bit); 22 glpointsize(1); *23 glbegin(gl_line_loop); *24 glcolor3f(1.0, 1.0, 0.0); /* yellow */ *25 for(deg = 0; deg < 360; deg = deg+60){ *26 x = RADIUS*cos(deg*M_PI/180); *27 y = RADIUS*sin(deg*M_PI/180); *28 glvertex2f(x0+x,y0+y); *29 }

18 30 glend(); 31 glutswapbuffers(); 32 } hexagon.c math.h RADIUS X0 Y0 display() hexagon.c hexagon.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 #include <math.h> * 5 #include <time.h> 6 7 #define WIDTH #define HIGHT #define RADIUS #define X #define Y0 150 *12 #define DEGSTEP void display(void); 15 void reshape(int w, int h); 16 void keyboard(unsigned char key, int x, int y); 17 void ginit(int* pargc, char** argv);

19 *18 void idle(void); 19 *20 int Degshift=0; 21 *22 void idle(void) *23 { *24 static int first = 1; *25 static time_t past; *26 time_t now; *27 *28 if(first == 1){ *29 time(&past); *30 first = 0; *31 return; *32 } *33 *34 time(&now); *35 *36 if(difftime(now,past) > 1.0){ *37 Degshift += DEGSTEP; *38 past = now; *39 } *40 *41 glutpostredisplay(); *42 } void display(void) 45 { 46 int x, y, deg; glclear(gl_color_buffer_bit); 49 glpointsize(1); 50 glbegin(gl_polygon); 51 glcolor3f(1.0, 1.0, 0.0); /* yellow */

20 52 for(deg = 0; deg < 360; deg = deg+60){ *53 x = RADIUS*cos((deg+Degshift)*M_PI/180); *54 y = RADIUS*sin((deg+Degshift)*M_PI/180); 55 glvertex2f(x0+x,y0+y); 56 } 57 glend(); 58 glutswapbuffers(); 59 } void reshape(int w, int h) 62 { 63 glviewport(0, 0, (GLsizei)w, (GLsizei)h ); 64 glmatrixmode(gl_projection); 65 glloadidentity(); 66 gluortho2d(0.0, (GLdouble)w, 0.0, (GLdouble) h); 67 } void keyboard(unsigned char key, int x, int y) 70 { 71 switch(key) { 72 case 'q': 73 case 'Q': 74 exit(0); 75 default: 76 break; 77 } 78 } void ginit(int* pargc, char** argv) 81 { 82 glutinit(pargc,argv); 83 glutinitdisplaymode(glut_double GLUT_RGB); 84 glutinitwindowsize(width,hight); 85 glutinitwindowposition(100,50);

21 86 glutcreatewindow("numerical Recipes for Polymer Science"); 87 glclearcolor(0.0,0.0,0.0,0.0); /* background color */ 88 glshademodel(gl_flat); 89 glutdisplayfunc(display); 90 glutreshapefunc(reshape); 91 glutkeyboardfunc(keyboard); *92 glutidlefunc(idle); 93 } int main(int argc, char* argv[]) 96 { 97 ginit(&argc,argv); 98 glutmainloop(); 99 return 0; 100 } 101 rothex.c time() time.h.h DEGSTEP idle(void) Degshift

22 glutidlefunc() 1 0 first static static time.h time_t now past now past time(&past) first return if time(&now) now difftime(now,past) now past Degshift DEGDTEP now past idle(void)

23 j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E a n 1 H = ae l j, j=1

24 l j = x j+1 x j, x n x 1 = n 1 j=1 l j, l j = ±l (l > 0) n 1 H = ϵ l j, j=1 ϵ e x x = 0 e x = j=0 x j j! = 1 + x x x j! xj +, 0! = 1 x = 1 e = j! + = j=0 1 j!, e = n j=0 1 j!. n 1 15 n

25 T j H j j Ψ j k Ψ j = 1 ( Z H ) j, k T Z = j ( H ) j, k T j T a b P a b ( H ) ( a P ab = H ) b P ba, k T k T

26 N N H 3N r N = (r 1, r 2, r N ) 3N p N = (p 1, p 2, p N ) H = N j=1 p 2 j 2m + U(r 1, r 2,, r N ), U r j = (x j, y j, z j ) p j = (p xj, p yj, p zj ) x j y j z j j x y z p xj p yj p zj p N r N r N = (r 1, r 2,, r N ) p N = (p 1, p 2,, p N ) r + r N = (r 1 + r 1, r 2 + r 2,, r N + r N ) p + p N = (p 1 + p 1, p 2 + p 2,, p N + p N ) ( H ) r N p N k T ( H ) k T Q r N Q < Q > ( Q ( Q H ) r N p N k < Q >= T ( H ) = r N p N k T U ) r N k T ), r N ( U k T N r N k t k t t m N 1 a x a y b z b

27 x a x a + δ x (1 2ξ 1 ), y a y a + δ y (1 2ξ 2 ), z a z a + δ z (1 2ξ 3 ). δ x, δ y, δ z x y z ξ j [0, 1] 8δ x δ y δ z t m t m t U t m U m U t U m k + 1 m U t < U m m [0, 1] η ( η < U ) m U t k T m k + 1 ( η > U ) m U t k T t k + 1 N l j = ±1 0

28 t m N l j 1 k t t m 1 n 1 a l a +1 1 l a l a 1 t m m t H t m H m H t H m k + 1 m H t < H m [0, 1] η m k + 1 ( η < H ) m H t k T ( η > H ) m H t k T t k + 1

29 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define N (20) 5 6 double uran(){ 7 return((double)rand()/rand_max); 8 } 9 10 int main() 11 { 12 float rn[n]; 13 int l[n]; 14 int j; for(j=0;j<n;j++){ 17 rn[j] = uran(); 18 if(rn[j] < 0.5){ 19 l[j] = -1; 20 }else{ 21 l[j] = 1; 22 } printf("%f,%2d\n",rn[j],l[j]); 25 } 26 return(0); 27 } 28

30 H ϵ = k = #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 5 #define N (100) 6 #define EP (6.0e-22) /* [J] */ 7 #define KB ( e-23) /* The Botzmann's constant [J/K] */ 8 #define MCTIME (1000) 9 10 double uran(){ 11 return((double)rand()/rand_max); 12 } int main() 15 { 16 int l[n],p[n+1]; 17 int k,j,mct,lbefore,end; 18 float dene,t; 19 FILE *fp; printf("temperature ="); 22 scanf("%f",&t); 23 printf("\n"); for(j=0;j<n;j++){ 26 l[j] = 1; 27 } for(j=0;j<n+1; j++){ 30 p[j] = 0;

31 31 } for(mct=0;mct<mctime;mct++){ 34 for(k=0;k<n;k++){ 35 j = (N+1)*uran(); 36 lbefore = l[j]; 37 l[j] *= (-1); 38 dene = - EP*l[j] - (-EP*lbefore); 39 if(dene > 0){ 40 if(exp(-dene/(kb*t)) < uran()){ 41 l[j] = lbefore; 42 } 43 } 44 } for(j=0,end=0;j<n;j++){ 47 end += l[j]; 48 } 49 p[(end+n)/2]++; printf("%d\n",mct); 52 } fp = fopen("result.txt","w"); for(j=0;j<(n+1);j++){ 57 fprintf(fp,"%d\t%e\n",2*j-n,((float)p[j])/mctime); 58 } fclose(fp); return(0); 63 } 64

32 65 result.txt $ mv result.txt 10.txt result.txt 10.txt 100.txt 1000.txt

33 [0, 1] uran() double j int l[n] [ ]... [ ] p[n+1] [ ]... [ ] lbefor end float dene t FILE fp t for for { }

34 j 0 l[j] = 1 j j + 1 j j < N l[j] j 0 N p[j] 0 p[j] mct { } mct 1 mct MCTIME N N 1 j 0 N l[j] l[j] 1 1 lbefore l[j] l[j] l[j] l[j] 1 l[j] l[j] *= (-1); l[j] = l[j]*(-1); l j l j l j H H H H = ϵ(l l j + + l N 1 ) ( ϵ)(l l j + + l N 1 ) = ϵl j ( ϵl j), dene

35 dene ( H ) H, k T H H [0, 1] l[j] x l j 1 x = N x = N 2 x 2 x = N, N + 2, N + 4,..., N 4, N 2, N j = (x+n)/2 x = N, N +2, N +4,..., N 4, N 2, N j = 0, 1, 2,..., N 2, N 1, N x = 2j N p[j] 1 p[j] x p[(x 1 x = 2j N result.txt 2j N p[j]/mctime n 1 H = ϵ l xj, j=1

36 l xj j x rothex.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 #include <math.h> 5 #include <time.h> 6 7 #define WIDTH #define HIGHT #define RADIUS #define LENGTH 3 11 #define X #define Y #define DEGSTEP #define N (100) 16 #define EP (6.0e-22) /* [J] */ 17 #define KB ( e-23) /* The Botzmann's constant [J/K] */ 18 #define MCTIME (1000) 19 #define DL (0.5) void display(void); 22 void reshape(int w, int h); 23 void keyboard(unsigned char key, int x, int y); 24 void ginit(int* pargc, char** argv); 25 void idle(void); int Degshift=0; 28 int Zoom=1,Stop=1; 29 float Ep,T, Lx[N], Ly[N]; 30 31

37 32 double uran(){ 33 return((double)rand()/rand_max); 34 } int mcrun() 38 { 39 int j; 40 float dene; 41 float lxbefore, lybefore; 42 float dx, dy, r; j = (N-1)*uran()+1; 45 lxbefore = Lx[j]; 46 lybefore = Ly[j]; do{ 49 dx = 2.0*DL*(uran()-0.5); 50 dy = 2.0*DL*(uran()-0.5); 51 }while( dx*dx + dy*dy > DL*DL); /* 54 Lx[j] = Lx[j] + dx; 55 Ly[j] = Ly[j] + dy; 56 */ Lx[j] = dx; 59 Ly[j] = dy; r = sqrt(lx[j]*lx[j] + Ly[j]*Ly[j]); 62 Lx[j] = Lx[j]/r; 63 Ly[j] = Ly[j]/r; dene = - Ep*Lx[j] - (-Ep*lxbefore);

38 66 dene = dene*ep; if(dene > 0){ 69 if(exp(-dene/(kb*t)) < uran()){ 70 Lx[j] = lxbefore; 71 Ly[j] = lybefore; 72 } 73 } return(0); 76 } void idle(void) 79 { 80 if(stop == 1)return; 81 mcrun(); 82 glutpostredisplay(); 83 } void display(void) 86 { 87 int x, y, j; glclear(gl_color_buffer_bit); 90 glpointsize(1); 91 glbegin(gl_line_strip); 92 glcolor3f(1.0, 1.0, 1.0); /* white */ 93 x = 0; 94 y = 0; 95 glvertex2f(x0+x, Y0+y); 96 for(j=1;j<n;j++){ 97 if(j%2 == 0){ 98 glcolor3f(1.0, 1.0, 1.0); 99 }else{

39 100 glcolor3f(1.0, 1.0, 0.0); 101 } 102 x = x+zoom*length*lx[j]; 103 y = y+zoom*length*ly[j]; 104 glvertex2f(x0+x, Y0+y); 105 } glend(); 108 glutswapbuffers(); 109 } void reshape(int w, int h) 112 { 113 glviewport(0, 0, (GLsizei)w, (GLsizei)h ); 114 glmatrixmode(gl_projection); 115 glloadidentity(); 116 gluortho2d(0.0, (GLdouble)w, 0.0, (GLdouble) h); 117 } void keyboard(unsigned char key, int x, int y) 120 { 121 switch(key) { 122 case 's': 123 Stop *= -1; 124 break; 125 case 'i': 126 if(zoom == 0){ 127 Zoom=1; 128 }else{ 129 Zoom *= 2; 130 } 131 break; 132 case 'o': 133 Zoom /= 2;

40 134 break; 135 case 'e': 136 printf("\nelectric field ="); 137 scanf("%f",&ep); 138 Stop = 1; 139 break; 140 case 't': 141 printf("\ntemperature ="); 142 scanf("%f",&t); 143 Stop = 1; 144 break; 145 case 'q': 146 case 'Q': 147 exit(0); 148 default: 149 break; 150 } 151 } void ginit(int* pargc, char** argv) 154 { 155 glutinit(pargc,argv); 156 glutinitdisplaymode(glut_double GLUT_RGB); 157 glutinitwindowsize(width,hight); 158 glutinitwindowposition(100,50); 159 glutcreatewindow("numerical Recipes for Polymer Science"); 160 glclearcolor(0.0,0.0,0.0,0.0); /* background color */ 161 glshademodel(gl_flat); 162 glutdisplayfunc(display); 163 glutreshapefunc(reshape); 164 glutkeyboardfunc(keyboard); 165 glutidlefunc(idle); 166 } 167

41 168 int main(int argc, char* argv[]) 169 { 170 int j; 171 ginit(&argc,argv); printf("temperature ="); 174 scanf("%f",&t); 175 printf("\n"); 176 printf("electric field ="); 177 scanf("%f",&ep); for(j=1;j<n;j++){ 180 Lx[j] = 0.0; 181 Ly[j] = 1.0; 182 } glutmainloop(); 185 return 0; 186 } 187

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E 8 9 7 6 4 2 3 5 1 j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E a n 1 H = ae l j, j=1 l j = x j+1 x j, x n x 1 = n 1 j=1 l j, l j = ±l l > 0) n 1 H = ϵ l j, j=1 ϵ e x x

More information

$ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a

$ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a $ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a $ ls -l $ ls -l -a $ ls -la $ ls -F $ ls $ cd $ cd $ pwd $ cat

More information

#include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 sta

#include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 sta 1 1. 1 #include 2 #include 3 #include 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 static bool KeyDownON = false; // 8 static bool KeyLeftON

More information

第3章 OpenGL の基礎

第3章 OpenGL の基礎 3 OpenGL April 11, 2017 1 / 28 3.1 ( ) OpenGL OpenGL 2 / 28 3.2 OpenGL OpenGL OpenGL (Open Graphics Library) Silicon Graphics, Inc. 2 3 API (Application Program Interface) [4] UNIX OS Windows Macintosh

More information

演算増幅器

演算増幅器 コンピュータグラフィックス 2 前回は GLUT を使った簡単な 2 次元グラフィックスについて習った 今週は以下の項目について 補足していく イベント駆動型プログラムの動作について コンピュータグラフィックスの座標系 イベント駆動型プログラム従来のプログラムとの違いこれまでに学習してきたプログラムは上から下に順次実行され 条件分岐や繰り返し処理によって プログラムの流れ (flow: フロー )

More information

1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - >

1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 8 (240 O p e n C V ) 9 opencv_core240d.lib 10 opencv_imgproc240d.lib

More information

3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程

3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程 3. 3D ビューイング 1. 3Dグラフィックス処理の一般過程 2. 射影と射影変換 3. ビューボリュームとクリッピング 4. 陰面処理とデプスバッファ 5. ビューポート変換 6. 3Dグラフィックスを描く 7. モデルビュー変換 3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程 3D グラフィックス処理の一般過程 1. モデリング変換 座標系の異なる複数のオブジェクトを仮想世界に配置し,

More information

/*p7-1-1*/

/*p7-1-1*/ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 /* e8.c Copyright (c) 2003 by T. HAYASHI and

More information

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h> 2007 12 5 1 2 2.1 ( ) 1 1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 #define H WIN 400 // 8 #define W WIN 300 // 9

More information

第3章 OpenGL の基礎

第3章 OpenGL の基礎 3 OpenGL April 20, 2012 1 / 23 31 ( ) OpenGL OpenGL 2 / 23 32 OpenGL OpenGL OpenGL (Open Graphics Library) Silicon Graphics, Inc 2 3 API (Application Program Interface) [4] UNIX OS Windows Macintosh CAD

More information

謗域・ュ逕ィppt

謗域・ュ逕ィppt 情報工学 2017 年度後期第 5 回 [11 月 1 日 ] 静岡大学 工学研究科機械工学専攻ロボット 計測情報講座創造科学技術大学院情報科学専攻 三浦憲二郎 講義日程 第 6 回 11 月 8 日画像処理パート第 1 回 第 7 回 11 月 15 日 CGパート第 6 回 第 8 回 11 月 22 日 CGパート第 7 回 第 9 回 11 月 29 日 CGパート試験 講義アウトライン [11

More information

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

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

More information

libaux.dvi

libaux.dvi AUX OpenGL 1 OpenGL (AUX libaux.a) OpenGL Programming Guide () OpenGL 1 OpenGL OS (API) OS OS OS OpenGL Windows Windows X X OpenGL Programming Guide AUX toolkit AUX OS OpenGL SGI OpenGL OS OpenGL AUX Windows

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

2 : 2008/12/ /01/ G :

2 : 2008/12/ /01/ G : 2 : 2008/12/08 2008/01/16 075730G : 1 project draw main.cpp 1 draw main.cpp /* * main.cpp * draw * * Created by C-T on 08/12/08. * Copyright 2008 MyCompanyName. All rights reserved. * */ #include

More information

2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut OpenGL glut C++ Linux, Windows (Visual C++, gcc), Macintosh glut glut GUI glut GUI CG glmultmatrix()

2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut OpenGL glut C++ Linux, Windows (Visual C++, gcc), Macintosh glut glut GUI glut GUI CG glmultmatrix() 1 20 (2) OpenGL+GUI(GLUI) 3DCG TA 2008 10 27 1 OpenGL OpenGL GUI GLUI 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2008/ 1.2 TA 1.3 2008/12/4( ) EyeToy 2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut

More information

演算増幅器

演算増幅器 スペースインベーダーもどき 1000 行プログラムの参考として スペースインベーダーもどきのプログラムを配布する いくつか習って いないものもあるので 補足の説明を加えていく 文字列の描画 文字の描画は glutbitmapcharacter() を用いる これは以下のようにして利用する int i; char *str = "Display String"; glcolor3f(0.0, 0.0,

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, IBM UNIX Linux, FreeBSD PC UNIX Windows, Mac OS API PD

2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, IBM UNIX Linux, FreeBSD PC UNIX Windows, Mac OS API PD 1 2015 5-1 2015 6 22 1 3DCG 3DCG 3DCG OpenGL OS Linux(Ubuntu) 1.1 TA 1.2 http://www.cyber.t.u-tokyo.ac.jp/~tani/class/mech_enshu/ 2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI)

More information

XMPによる並列化実装2

XMPによる並列化実装2 2 3 C Fortran Exercise 1 Exercise 2 Serial init.c init.f90 XMP xmp_init.c xmp_init.f90 Serial laplace.c laplace.f90 XMP xmp_laplace.c xmp_laplace.f90 #include int a[10]; program init integer

More information

1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber();

1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber(); : : :0757230G :2008/07/18 2008/08/17 1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include class Number Number(); // ~Number(); // void setnumber(float n); float getnumber(); private: float num; ;

More information

C B

C B C 095707B 2010 6 8 1 LEVE1 2 1.1 LEVEL 1.1................................................ 2 1.1.1 1................................................ 2 1.1.2 1.2..............................................

More information

x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x i ) A(x i ) = h 2 {f(x i) + f(x i+1 ) = h {f(a + i h) + f(a + (i + 1) h), (2) 2 a b n A(x i )

x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x i ) A(x i ) = h 2 {f(x i) + f(x i+1 ) = h {f(a + i h) + f(a + (i + 1) h), (2) 2 a b n A(x i ) 1 f(x) a b f(x)dx = n A(x i ) (1) ix [a, b] n i A(x i ) x i 1 f(x) [a, b] n h = (b a)/n y h = (b-a)/n y = f (x) h h a a+h a+2h a+(n-1)h b x 1: 1 x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x

More information

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

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t 1 22 (2) OpenGL+GUI(GLUI) 3DCG TA 2010 10 18 1 OpenGL OpenGL GUI GLUI 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2010/ 1.2 TA 1.3 2010/12/6( ) USB 2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height

More information

2 T ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy ( ) ( ) ( ) ( ) u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a

2 T ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy ( ) ( ) ( ) ( ) u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a 2 T140073 1 2 ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a cos θ, v = v 0 + b tan θ π 2 < θ < π 2 u = u 0 + 2pt, v = v 0 + pt

More information

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

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) * *

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) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 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) +

More information

準備 計算結果を可視化するために OpenGL を 利用する. 2

準備 計算結果を可視化するために OpenGL を 利用する. 2 2. 2 次元粒子法シミュレーション (+ 少しだけ OpenGL) 茨城大学工学部 教授乾正知 準備 計算結果を可視化するために OpenGL を 利用する. 2 OpenGL 3 次元コンピュータグラフィックス用の標準的なライブラリ. 特に CAD やアート, アニメーション分野 ( ゲーム以外の分野 ) で広く利用されている. OpenGL は仕様がオープンに決められており, 企業から独立した団体が仕様を管理している.

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

2 2 OpenGL ( ) OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf

2 2 OpenGL ( ) OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf 1 24 (1) OpenGL TA 2012 10 11 1 C OpenGL (3DCG) OS Linux OS 3DCG OpenGL GUI GLUT OpenGL GLUT GLUI 3DCG 3DCG 1.1 1 3DCG 3DCG GUI 2 3DCG 10/10( ) 11/11( ) 3DCG OpenGL OpenGL+GUI(GLUI) 3DCG 3DCG 1.2 TA 2

More information

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

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

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

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

comment.dvi

comment.dvi ( ) (sample1.c) (sample1.c) 2 2 Nearest Neighbor 1 (2D-class1.dat) 2 (2D-class2.dat) (2D-test.dat) 3 Nearest Neighbor Nearest Neighbor ( 1) 2 1: NN 1 (sample1.c) /* -----------------------------------------------------------------

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

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

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

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

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 II 8 2003 11 12 1 6 ( ) 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 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

/* drawing function */ function_graph();// drawing graph glflush(); int main(int argc, char **argv ) glutinit( &argc, argv ); glutinitdisplaymode( GLU

/* drawing function */ function_graph();// drawing graph glflush(); int main(int argc, char **argv ) glutinit( &argc, argv ); glutinitdisplaymode( GLU OpenGL ( ) #include #include #define PI 3.14159265 void function_graph() int j; float x, y; glbegin( GL_LINE_STRIP );// sine curve by line glcolor3f( 0.0f, 1.0f, 1.0f );// line color

More information

/* 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

/* 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 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf(hello World\n); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o 18 C ( ) 1 1 1.1 hello world.c 5 printf("hello World\n"); 6 } [ ] [ ] #include % cc hello_world.c %./a.out Hello World [a.out ] % cc hello_world.c -o hello_world [ ( ) ] (K&R 4.1.1) #include

More information

Microsoft Word - Cプログラミング演習(12)

Microsoft Word - Cプログラミング演習(12) 第 12 回 (7/9) 4. いくつかのトピック (5)main 関数の引数を利用したファイル処理 main 関数は, 起動する環境から引数を受け取ることができる 例えば 次に示すように,main 関数に引数を用いたプログラムを作成する 01 /* sample */ 02 /* main 関数の引数 */ 03 #include 04 05 main(int argc, char

More information

programmingII2019-v01

programmingII2019-v01 II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2

More information

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

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

2 2 OpenGL OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN,

2 2 OpenGL OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, 1 20 (1) OpenGL TA 2008 10 20 1 C OpenGL (3DCG) OS Linux (Open SUSE 10.3) 3DCG OpenGL GUI GLUT OpenGL GLUT GLUI USB EyeToy 1.1 1 3DCG 2 3DCG GUI 2 USB EyeToy) 10/20( ) 10/27( ) 3DCG OpenGL OpenGL+GUI(GLUI)

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

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

Microsoft PowerPoint - program.ppt [互換モード] プログラミング演習 バージョン 1 担当教員 : 綴木馴 プログラムの決まりについて学ぶ おすすめする参考書 ザ C 戸川隼人サイエンス社 本日の予定 1. 授業の説明. 2. コンパイラーのインストール. プログラムの決まりについて学ぶ,P31 /* The most in C */ /* hello.c */ printf("hello,world n"); プログラムの決まり ( コメント )

More information

‚æ2›ñ C„¾„ê‡Ìš|

‚æ2›ñ C„¾„ê‡Ìš| I 8 10 10 I ( 6 ) 10 10 1 / 23 1 C ( ) getchar(), gets(), scanf() ( ) putchar(), puts(), printf() 1 getchar(), putchar() 1 I ( 6 ) 10 10 2 / 23 1 (getchar 1 1) 1 #include 2 void main(void){ 3 int

More information

1 OpenGL OpenGL OpenGL OpenGL

1 OpenGL OpenGL OpenGL OpenGL 2008 OpenGL 2009 2 27 1 OpenGL 4 1.1 OpenGL.............................. 4 1.2 OpenGL............... 4 1.2.1............... 4 1.2.2............................. 5 2 OpenGL 6 2.1.......................

More information

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

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó  ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡ (2018) 2018 5 24 ( ) while ( ) do while ( ); for ( ; ; ) while int i = 0; while (i < 100) { printf("i = %3d\n", i); i++; while int i = 0; i while (i < 100) { printf("i = %3d\n", i); i++; while int i =

More information

Informatics 2010.key

Informatics 2010.key http://math.sci.hiroshima-u.ac.jp/ ~ryo/lectures/informatics2010/ 1 2 C ATM etc. etc. (Personal Computer) 3 4 Input Output Device Central Processing Unit I/O CPU Memory 5 6 (CPU),,... etc. C, Java, Fortran...

More information

Informatics 2014

Informatics 2014 C 計算機の歴史 手回し計算機 新旧のソロバン バベッジの階差機関 スパコン ENIAC (1946) パソコン 大型汎用計算機 電卓 現在のコンピュータ Input Output Device Central Processing Unit I/O CPU Memory OS (Operating System) OS Windows 78, Vista, XP Windows Mac OS X

More information

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

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 C 1 / 21 C 2005 A * 1 2 1.1......................................... 2 1.2 *.......................................... 3 2 4 2.1.............................................. 4 2.2..............................................

More information

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word

More information

slide5.pptx

slide5.pptx ソフトウェア工学入門 第 5 回コマンド作成 1 head コマンド作成 1 早速ですが 次のプログラムを head.c という名前で作成してください #include #include static void do_head(file *f, long nlines); int main(int argc, char *argv[]) { if (argc!=

More information

273? C

273? C TSG Theoretical Science Group 273? C 2-1.................................. 2 -1. Windows Mac Mac UNIX CUI bash >_ Finder TSG No.273? 2 3 pwd ls cd ( ) change directory 3 TSG No.273? cd hoge cd hoge cd....../

More information

kiso2-09.key

kiso2-09.key 座席指定はありません 計算機基礎実習II 2018 のウェブページか 第9回 ら 以下の課題に自力で取り組んで下さい 計算機基礎実習II 第7回の復習課題(rev07) 第9回の基本課題(base09) 第8回試験の結果 中間試験に関するコメント コンパイルできない不完全なプログラムなど プログラミングに慣れていない あるいは複雑な問題は 要件 をバラして段階的にプログラムを作成する exam08-2.c

More information

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

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

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

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

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用 第 15 回 知的情報システム学科張 暁華 プログラミング応用 1 授業のマナー ------ 人の話を聞くときの社会常識 1. 欠席者のかわりに登録を行わない 倫理に反することをやらない あなたの信を問われている蟻の穴から堤防が決壊 2. 私語しないこと : 質問 意見は手を挙げて大きな声ではっきりと意思表示 3. 授業以外のことをしない : 携帯をカバンにいれ イヤホンを使って音楽等を聞かない授業中ゲームを遊ばない

More information

第5回お試しアカウント付き並列プログラミング講習会

第5回お試しアカウント付き並列プログラミング講習会 qstat -l ID (qstat -f) qscript ID BATCH REQUEST: 253443.batch1 Name: test.sh Owner: uid=32637, gid=30123 Priority: 63 State: 1(RUNNING) Created at: Tue Jun 30 05:36:24 2009 Started at: Tue Jun 30 05:36:27

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

1 4 2 EP) (EP) (EP)

1 4 2 EP) (EP) (EP) 2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)

More information

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç C (3) if else switch AND && OR (NOT)! 1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 1 BMI BMI BMI = 10

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

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

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 I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT

More information

untitled

untitled 2004/12/21 2/2 (11/16) DT-MRI (11/30) /OpenGL 12/7 12/14 (12/21) 1/11 (1/18) OpenGL ~ ~ OpenGL Silicon Graphics, OpenGL ~ ~ OpenGL OpenGL Utility Library (GLU) OpenGL. OpenGL. OpenGL Utility Toolkit (GLUT)

More information

P05.ppt

P05.ppt 2 1 list0415.c forfor #include int i, j; for (i = 1; i

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

実際の株価データを用いたオプション料の計算

実際の株価データを用いたオプション料の計算 2002 2 20 1 1 3 2 3 2.1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : 5 2.1.1 : : : : : : : : : : : : : : : : : : : : 5 2.1.2 : : : : : : : : : : : : : : : : : : : : 6 2.2 : : : : : : : : : :

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru 43 6 MPI MPI(Message Passing Interface) MPI 1CPU/1 PC Cluster MPICH[5] 6.1 MPI MPI MPI 1 : #include 2 : #include 3 : #include 4 : 5 : #include "mpi.h" 7 : int main(int argc,

More information

Ⅰ Report#1 Report#1 printf() /* Program : hello.c Student-ID : 095740C Author UpDate Comment */ #include int main(){ : Yuhi,TOMARI : 2009/04/28(Thu) : Used Easy Function printf() 10 printf("hello,

More information

pptx

pptx iphone 2010 8 18 C xkozima@myu.ac.jp C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

#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

#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 =1= (.5, 1.65), (1., 2.72), (2., 7.39).2,.4,.6,.8, 1., 1.2, 1.4, 1.6 1 1: x.2 1.4128.4 1.5372.6 1.796533.8 2.198 1.2 3.384133 1.4 4.1832 1.6 5.1172 8 7 6 5 y 4 3 2 1.5 1 1.5 2 x 1: /* */ #include

More information

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

(search: ) [1] ( ) 2 (linear search) (sequential search) 1 2005 11 14 1 1.1 2 1.2 (search:) [1] () 2 (linear search) (sequential search) 1 2.1 2.1.1 List 2-1(p.37) 1 1 13 n

More information

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² – (2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001

More information

2 P.S.P.T. P.S.P.T. wiki 26

2 P.S.P.T. P.S.P.T. wiki  26 P.S.P.T. C 2011 4 10 2 P.S.P.T. P.S.P.T. wiki p.s.p.t.since1982@gmail.com http://www23.atwiki.jp/pspt 26 3 2 1 C 8 1.1 C................................................ 8 1.1.1...........................................

More information

5. p.1/37

5. p.1/37 5. taiji@aihara.co.jp p.1/37 dx dt dy dt dz dt = σx + σy = xz + rx y = xy bz σ = 10, b = 8/3, r = 28, x 0 = 10, y 0 = 20, z 0 = 30 t < 10000δt (δt = 0.01) p.2/37 , 1991. Numerical Recipes in C Netlib LAPACK,

More information

Krylov (b) x k+1 := x k + α k p k (c) r k+1 := r k α k Ap k ( := b Ax k+1 ) (d) β k := r k r k 2 2 (e) : r k 2 / r 0 2 < ε R (f) p k+1 :=

Krylov (b) x k+1 := x k + α k p k (c) r k+1 := r k α k Ap k ( := b Ax k+1 ) (d) β k := r k r k 2 2 (e) : r k 2 / r 0 2 < ε R (f) p k+1 := 127 10 Krylov Krylov (Conjugate-Gradient (CG ), Krylov ) MPIBNCpack 10.1 CG (Conjugate-Gradient CG ) A R n n a 11 a 12 a 1n a 21 a 22 a 2n A T = =... a n1 a n2 a nn n a 11 a 21 a n1 a 12 a 22 a n2 = A...

More information

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)

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) E-mail: takio-kurita@aist.go.jp 1 ( ) CPU ( ) 2 1. a f(a) =(a 1.0) 2 (1) a ( ) 1(a) f(a) a (1) a f(a) a =2(a 1.0) (2) 2 0 a f(a) a =2(a 1.0) = 0 (3) 1 9 8 7 (x-1.0)*(x-1.0) 6 4 2.0*(x-1.0) 6 2 5 4 0 3-2

More information

導入基礎演習.ppt

導入基礎演習.ppt Multi-paradigm Programming Functional Programming Scheme Haskell ML Scala X10 KL1 Prolog Declarative Lang. C Procedural Lang. Java C++ Python Object-oriented Programming / (root) bin home lib 08 09

More information

1 5 13 4 1 41 1 411 1 412 2 413 3 414 3 415 4 42 6 43 LU 7 431 LU 10 432 11 433 LU 11 44 12 441 13 442 13 443 SOR ( ) 14 444 14 445 15 446 16 447 SOR 16 448 16 45 17 4 41 n x 1,, x n a 11 x 1 + a 1n x

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

21 B92 B92 Quantum cryptography simulator

21 B92 B92 Quantum cryptography simulator 21 B92 B92 Quantum cryptography simulator 1100348 2010 3 1 B92 BB84 BB84 E91 B92 2 3 B92 4 3 5 B92, i Abstract B92 Quantum cryptography simulator Soichiro MATSUMOTO English Nowadays, the public key cryptosystem

More information

BW BW

BW BW Induced Sorting BW 11T2042B 2015 3 23 1 1 1.1................................ 1 1.2................................... 1 2 BW 1 2.1..................................... 2 2.2 BW.................................

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

Informatics 2015

Informatics 2015 C 計算機の歴史 新旧のソロバン バベッジの階差機関 19C前半 手回し計算機 19C後半 20C後半 スパコン 1960年代 ENIAC (1946) 大型汎用計算機 1950年代 1980年代 電卓 1964 パソコン 1970年代 現在のコンピュータ Input Output Device Central Processing Unit I/O CPU Memory OS (Operating

More information

I J

I J I 065763J 8 7 7 31 jikken/ +----- accumulation_demupa.c +----- accumulation_rain.c +----- frequency_demupa.c +----- frequency_rain.c +----- go.sh +----- graph_maker.sh +----- mesure-ryudai/ 2007/4/1 2007/6/30

More information

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf(hello World!!\n); return 0; 戻り値 1: main() 2.2 C main C 2007 5 29 C 1 11 2 2.1 main() 1 FORTRAN C main() main main() main() 1 return 1 1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return

More information

AutoTuned-RB

AutoTuned-RB ABCLib Working Notes No.10 AutoTuned-RB Version 1.00 AutoTuned-RB AutoTuned-RB RB_DGEMM RB_DGEMM ( TransA, TransB, M, N, K, a, A, lda, B, ldb, b, C, ldc ) L3BLAS DGEMM (C a Trans(A) Trans(B) b C) (1) TransA:

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information