Numerical Rosetta Stone 1 C, Java, Perl, Ruby, Python [ ] Hello world C: /* hello.c $> gcc hello.c $>./a.out */ #include <stdio.h> main(){ printf("hel

Size: px
Start display at page:

Download "Numerical Rosetta Stone 1 C, Java, Perl, Ruby, Python [ ] Hello world C: /* hello.c $> gcc hello.c $>./a.out */ #include <stdio.h> main(){ printf("hel"

Transcription

1 Numerical Rosetta Stone 1 C, Java, Perl, Ruby, Python [ ] Hello world C: /* hello.c $> gcc hello.c $>./a.out */ #include <stdio.h> main(){ printf("hello world of C!\n"); Java: // hello.java $> javac hello.java $> java hello public class hello{ public static void main(string args[]){ System.out.println("Hello world of Java!\n"); Perl: # hello.pl $> perl hello.pl print "Hello world of Perl!\n"; Ruby: # hello.rb $> ruby hello.rb print "Hello world of Ruby!\n" Python # hello.py $> python hello.py print Hello world of Python! 1

2 [ ] π = C: /* pi.c $> gcc pi.c -lm $>./a.out */ #include <stdio.h> #include <math.h> main(){ double pi=4*atan(1); printf("%lf\n", pi); Java: // pi.java $> javac pi.java $> java pi public class pi{ public static void main(string args[]){ double pi=4*math.atan(1); System.out.println(pi); Perl: # pi.pl $> perl pi.pl $pi=4*atan2(1,1); print $pi; Ruby: # pi.rb $> ruby pi.rb print 4*Math.atan(1) # include Math print PI # PI E Python: # pi.py $> python pi.py import math print 4*math.atan(1) 2

3 2 [ ] F n+1 = F n + F n 1 F 0 = 1, F 1 = 1 C: /* fibo.c */ #include <stdio.h> int fibo(int n){ int j, f0=1, f1=1, ff; if(n==0) ff=f0; elseif(n==1) ff=f1; else{ for(j=1; j<n; j++){ ff=f0+f1; f0=f1; f1=ff; ff=f1; return ff; main(){ int j, ans, n=50; for(j=0; j<=n; j++){ ans=fibo(j); printf("f(%d)=%d\n", j, ans); Java: // fibo.java public class fibo{ public static int F(int n){ int j, f0=1, f1=1, ff=2; if(n==0) ff=f0; else if(n==1) ff=f1; else{ for(j=1; j<n; j++){ ff=f0+f1; f0=f1; f1=ff; 3

4 return ff; public static void main(string args[]){ int j, ans, n=50; for(j=0; j<=n; j++){ ans=f(j); System.out.println("F("+j+")="+ans); Perl: # fibo.pl $n=50; for($j=0; $j<=$n; $j++){ $ff=fibo($j); print "F($j)=$ff \n"; sub fibo{ $f0=1; $f1=1; if($_[0]==0){ $ff=$f0; elsif($_[0]==1){ $ff=$f1; else{ for($k=1; $k<$_[0]; $k++){ $ff=$f0+$f1; $f0=$f1; $f1=$ff; return $ff; Ruby: #fibo.rb def fibo(n) f0, f1=1, 1 if n==0 then ff=f0 elsif n==1 then ff=f1 else 4

5 for j in 1..(n-1) f0, f1=f1, f0+f1 ff=f1 return ff for k in print("f(",k,")=",fibo(k),"\n") Python: # fibo.py def fibo(n): f0=1 f1=1 j=1 if n==0: ff=f0 elif n==1: ff=f1 else: while j<n: ff=f0+f1 f0=f1 f1=ff j+=1 return ff k=0 while k<=50: print F(,k, )=,fibo(k) k+=1 fibo(n)=fibo(n-1)+fibo(n-2) n! 5

6 [ ] n! C: /* factorial.c */ #include <stdio.h> int factorial(int n){ int ff; if(n==0) ff=1; else{ ff=(n*factorial(n-1)); return ff; main(){ int j; for(j=0; j<=20; j++){ printf("%d!=%d\n", j, factorial(j)); Java: // factorial.java public class factorial{ public static int F(int n){ int j, ff; if(n==0) ff=1; else{ ff=n*f(n-1); return ff; public static void main(string args[]){ int j, ans, n=20; for(j=0; j<=n; j++){ ans=f(j); System.out.println(j+"!="+ans); Perl: # factorial.pl 6

7 $n=20; for($j=0; $j<=$n; $j++){ $ff=factorial($j); print "$j!=$ff \n"; sub factorial{ if($_[0]==0){ $ff=1; else{ $ff=$_[0]*factorial($_[0]-1); return $ff; Ruby: #factorial.rb def factorial(n) if n==0 then ff=1 else ff=n*factorial(n-1) return ff for j in print(j,"!=",factorial(j), "\n") Python def factorial(n): if n==0: ff=1 else: ff=n*factorial(n-1) return ff j=0 while j<=20: print j,!=,factorial(j) j+=1 7

8 3 [ ] f(x) = 0 x x 0 x n+1 = x n f(x n) f (x n ) n f(x ) = 0 x f(x) f(x) = x = C: /* newton.c */ #include <stdio.h> double rhs(double x, double a){ return ((x+a/x)/2); main(){ int n; double x, a; a=2; x=a; for(n=0; n<10; n++){ x=rhs(x, a); printf("%lf\n", x); Java: // newton.java public class newton{ public static double rhs(double x, double a){ return ((x+a/x)/2); public static void main(string args[]){ int n; double x, a; a=2; x=a; for(n=0; n<10; n++){ x=rhs(x,a); System.out.println(x); 8

9 Perl: # newton.pl $a=2; $x=$a; for($n=0; $n<10; $n++){ $x=rhs($x, $a); print "$x \n"; sub rhs{ return (($_[0]+$_[1]/$_[0])/2); Ruby: #newton.rb def rhs(x, a) return (x+a/x)/2 a=2 x=a for n in x=rhs(x, a) print(x, "\n") Python: #newton.py def rhs(x, a): return ((x+a/x)/2) a=2.0 x=a n=0 while n<10: x=rhs(x, a) print x n+=1 9

10 [ ] f(x) x 0 < x 1 f(x 0 ) f(x 1 ) < 0 x 0 < x < x 1 f(x) = 0 x f(x) = x C: /* bisection.c */ #include <stdio.h> double residue(double x, double a){ return (x*x-a); main(){ int n; double x, a, left, right, center; a=2.0; left=0; right=a; center=(left+right)/2; for(n=0; n<30; n++){ if(residue(center, a)>0){ right=center; else{ left=center; center=(left+right)/2; printf("%15.13f\n", center); Java: // bisection.java public class bisection{ public static double residue(double x, double a){ return (x*x-a); public static void main(string args[]){ int n; double x, a, left, right, center; a=2.0; 10

11 left=0; right=a; center=(left+right)/2; for(n=0; n<30; n++){ if(residue(center, a)>0){ right=center; else{ left=center; center=(left+right)/2; System.out.println(center); Perl: # bisection.pl $a=2.0; $left=0.0; $right=$a; $center=($left+$right)/2.0; for($n=0; $n<30; $n++){ if(residue($center, $a)>0){ $right=$center; else{ $left=$center; $center=($left+$right)/2.0; print "$center\n"; sub residue{ return ($_[0]*$_[0]-$_[1]); Ruby: #bisection.rb def residue(x, a) return (x*x-a) a=2.0 left, right=0, a center=(left+right)/2; for n in

12 if residue(center, a)>0 then right=center else left=center center=(left+right)/2 print(center, "\n") Python: #bisection.py def residue(x, a): return (x*x-a) a=2.0 left=0.0 right=a center=(left+right)/2 n=0 while n<30: if residue(center, a)>0: right=center else: left=center center=(left+right)/2 print center n+=1 12

13 4 [ ] b a f(x)dx = N 1 j=0 h 2 (f(x j) + f(x j + h)), ( h = b a ) N, x j = a + j h 0 x 1, f(x) = 1/(x 2 + 1) π/4 C: /* sekibun.c */ #include <stdio.h> #include <math.h> double f(double x){ return (1/(x*x+1)); main(){ int j, N=100; double h, x, S; h=1/(double)n; S=0.0; for(j=0; j<n; j++){ x=h*(double)j; S+=(h/2)*(f(x)+f(x+h)); printf("%lf %lf\n", S, atan(1)); Java: // sekibun.java public class sekibun{ public static double f(double x){ return (1/(x*x+1)); public static void main(string args[]){ int j, N; double h, x, S; N=100; h=1/(double)n; S=0.0; for(j=0; j<n; j++){ x=h*(double)j; 13

14 S+=(h/2)*(f(x)+f(x+h)); System.out.println(S); System.out.println(Math.atan(1)); Perl: # sekibun.pl $N=100; $h=1.0/$n; $S=0.0; for($j=0; $j<$n; $j++){ $x=$h*$j; $S+=($h/2)*(f($x)+f($x+$h)); print "$S\n"; print atan2(1,1); sub f{ return (1/($_[0]*$_[0]+1)); Ruby: # sekibun.rb def f(x) return (1/(x*x+1)) N=100 h=1.0/n s=0.0 # for j in 1..N x=h*(j-1) s+=(h/2)*(f(x)+f(x+h)) print(s,"\n",math.atan(1.0)) Python: # sekibun.py import math def f(x): return (1/(x*x+1)) 14

15 N=100 h=1.0/n S=0.0 j=0 while j<n: x=h*j S+=(h/2)*(f(x)+f(x+h)) j+=1 print S print math.atan(1) [ ] K(k) = π 2 0 dx 1 k 2 sin 2 x (0 k 1) k K(k) C: #include <stdio.h> #include <math.h> double f(double x, double k){ return (1/(sqrt(1-pow(k*sin(x),2)))); main(){ int j, n, N=100; double x, k; double pi, h, S; k=0.0; pi=4*atan(1.0); h=pi/(2*(double)n); for(j=0; j<50; j++){ S=0.0; for(n=0; n<n; n++){ x=h*(double)n; S+=(h/2)*(f(x, k)+f(x+h, k)); printf("%lf %lf\n", k, S); k+=0.02; 15

16 Java: // elliptic.java public class elliptic{ public static double f(double x, double k){ return (1/(Math.sqrt(1-Math.pow(k*Math.sin(x),2)))); public static void main(string args[]){ int i, j, N; double pi, h, x, k, S; N=100; pi=4*math.atan(1); h=(pi/2)/(double)n; for(i=0; i<50; i++){ k=0.02*(double)i; S=0.0; for(j=0; j<n; j++){ x=h*(double)j; S+=(h/2)*(f(x,k)+f(x+h,k)); System.out.println(k+" "+S); Perl: # elliptic.pl $N=100; $pi=4*atan2(1,1); $h=($pi/2)/$n; for($i=0; $i<50; $i++){ $k=0.02*$i; $S=0.0; for($j=0; $j<$n; $j++){ $x=$h*$j; $S+=($h/2)*(f($x,$k)+f($x+$h,$k)); print "$k $S\n"; 16

17 sub f{ return (1/(sqrt(1-($_[1]*sin($_[0]))**2))); Ruby: #elliptic.rb def f(x, k) return (1/Math.sqrt(1-(k*Math.sin(x))**2)) N=100 pi=4.0*math.atan(1.0) h=(pi/2)/n for i in k=i/50.0 s=0.0 for j in 1..n x=h*(j-1) s+=(h/2)*(f(x, k)+f(x+h, k)) print(k, " ", s, "\n") Python: # elliptic.py import math def f(x, k): return (1/(math.sqrt(1-pow(k*math.sin(x),2)))) N=100 pi=4*math.atan(1) h=(pi/2)/n i=0 while i<50: k=0.02*i S=0.0 j=0 while j<n: x=h*j S+=(h/2)*(f(x,k)+f(x+h,k)) 17

18 j+=1 print k, i+=1,s 18

19 5 [ ] dx = σ(x y) dt σ = 10 dy = y + rx xz dt r = 28 dz = bz + xy dt b = 8/3 t = nh dx dt = f(x, t) k 1 = h f(x n, t), k 2 = h f(x n + k 1, t + h) x n+1 = x n (k 1 + k 2 ) k 1 = h f(x n, t), k 2 = h f(x n k1, t + h 2 ), k 3 = h f(x n k2, t + h 2 ), k 4 = h f(x n + k 3, t + h) x n+1 = x n (k1 + 2 k k 3 + k 4 ) explicit method C: /* lorenz.c */ #include <stdio.h> #define sigma 10.0 #define r 28.0 #define b 8.0/3.0 double X(double x, double y, double z){ return (-sigma*(x-y)); double Y(double x, double y, double z){ 19

20 return (-y+r*x-x*z); double Z(double x, double y, double z){ return (-b*z+x*y); void rk4(double x,double y,double z, double *xx,double *yy,double *zz,double h){ double x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4; x1=h*x(x,y,z); y1=h*y(x,y,z); z1=h*z(x,y,z); x2=h*x(x+x1/2,y+y1/2,z+z1/2); y2=h*y(x+x1/2,y+y1/2,z+z1/2); z2=h*z(x+x1/2,y+y1/2,z+z1/2); x3=h*x(x+x2/2,y+y2/2,z+z2/2); y3=h*y(x+x2/2,y+y2/2,z+z2/2); z3=h*z(x+x2/2,y+y2/2,z+z2/2); x4=h*x(x+x3,y+y3,z+z3); y4=h*y(x+x3,y+y3,z+z3); z4=h*z(x+x3,y+y3,z+z3); *xx=x+(x1+2*x2+2*x3+x4)/6; *yy=y+(y1+2*y2+2*y3+y4)/6; *zz=z+(z1+2*z2+2*z3+z4)/6; main(){ int j, N=1000; double h, x, y, z, xx, yy, zz; /* initial condition */ x=1.0; y=1.0; z=1.0; printf("%lf %lf %lf\n", x, y, z); /* time step */ h=0.01; /* time development */ for(j=0; j<n; j++){ rk4(x,y,z,&xx,&yy,&zz,h); x=xx; y=yy; z=zz; printf("%lf %lf %lf\n", x, y, z); Java: 20

21 // lorenz.java public class lorenz{ static double sigma=10.0, r=28.0, b=8.0/3.0; public static double X(double x,double y,double z){ return (-sigma*(x-y)); public static double Y(double x,double y,double z){ return (-y+r*x-x*z); public static double Z(double x,double y,double z){ return (-b*z+x*y); public static void main(string args[]){ int j, N=1000; double h, x, y, z; double x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4; // initial condition x=1.0; y=1.0; z=1.0; System.out.println(x+" "+y+" "+z); // time step h=0.01; // time development for(j=0; j<n; j++){ x1=h*x(x,y,z); y1=h*y(x,y,z); z1=h*z(x,y,z); x2=h*x(x+x1/2,y+y1/2,z+z1/2); y2=h*y(x+x1/2,y+y1/2,z+z1/2); z2=h*z(x+x1/2,y+y1/2,z+z1/2); x3=h*x(x+x2/2,y+y2/2,z+z2/2); y3=h*y(x+x2/2,y+y2/2,z+z2/2); z3=h*z(x+x2/2,y+y2/2,z+z2/2); x4=h*x(x+x3,y+y3,z+z3); y4=h*y(x+x3,y+y3,z+z3); z4=h*z(x+x3,y+y3,z+z3); x+=(x1+2*x2+2*x3+x4)/6; y+=(y1+2*y2+2*y3+y4)/6; z+=(z1+2*z2+2*z3+z4)/6; System.out.println(x+" "+y+" "+z); 21

22 Perl: # lorenz.pl $sigma=10.0; $r=28.0; $b=8.0/3.0; # initial condition $x=1.0; $y=1.0; $z=1.0; print "$x $y $z \n"; # time step $h=0.01; $N=1000; # time development for($j=0; $j<$n; $j++){ $x1=$h*x($x,$y,$z); $y1=$h*y($x,$y,$z); $z1=$h*z($x,$y,$z); $x2=$h*x($x+$x1/2,$y+$y1/2,$z+$z1/2); $y2=$h*y($x+$x1/2,$y+$y1/2,$z+$z1/2); $z2=$h*z($x+$x1/2,$y+$y1/2,$z+$z1/2); $x3=$h*x($x+$x2/2,$y+$y2/2,$z+$z2/2); $y3=$h*y($x+$x2/2,$y+$y2/2,$z+$z2/2); $z3=$h*z($x+$x2/2,$y+$y2/2,$z+$z2/2); $x4=$h*x($x+$x3,$y+$y3,$z+$z3); $y4=$h*y($x+$x3,$y+$y3,$z+$z3); $z4=$h*z($x+$x3,$y+$y3,$z+$z3); $x+=($x1+2*$x2+2*$x3+$x4)/6; $y+=($y1+2*$y2+2*$y3+$y4)/6; $z+=($z1+2*$z2+2*$z3+$z4)/6; print "$x $y $z \n"; sub X($x, $y, $z){ return (-$sigma*($x-$y)); sub Y($x, $y, $z){ return (-$y+$r*$x-$x*$z); sub Z($x, $y, $z){ return (-$b*$z+$x*$y); 22

23 Ruby: # lorenz.rb def X(x, y, z) return (-Sigma*(x-y)) def Y(x, y, z) return (-y+r*x-x*z) def Z(x, y, z) return (-B*z+x*y) Sigma, R, B=10.0, 28.0, 8.0/3.0 # # initial condition x, y, z=1.0, 1.0, 1.0 print(x," ",y," ",z,"\n") # time step h=0.01 N=1000 # time development for j in 1..N x1=h*x(x,y,z) y1=h*y(x,y,z) z1=h*z(x,y,z) x2=h*x(x+x1/2,y+y1/2,z+z1/2) y2=h*y(x+x1/2,y+y1/2,z+z1/2) z2=h*z(x+x1/2,y+y1/2,z+z1/2) x3=h*x(x+x2/2,y+y2/2,z+z2/2) y3=h*y(x+x2/2,y+y2/2,z+z2/2) z3=h*z(x+x2/2,y+y2/2,z+z2/2) x4=h*x(x+x3,y+y3,z+z3) y4=h*y(x+x3,y+y3,z+z3) z4=h*z(x+x3,y+y3,z+z3) x+=(x1+2*x2+2*x3+x4)/6 y+=(y1+2*y2+2*y3+y4)/6 z+=(z1+2*z2+2*z3+z4)/6 print(x," ",y," ",z,"\n") Python: #lorenz.py 23

24 def X(x, y, z): return (-sigma*(x-y)) def Y(x, y, z): return (-y+r*x-x*z) def Z(x, y, z): return (-b*z+x*y) sigma=10.0 r=28.0 b=8.0/3.0 # initial condition x=1.0 y=1.0 z=1.0 print x,,y,,z # time step h=0.01 N=1000 # time development j=0 while j<n: x1=h*x(x,y,z) y1=h*y(x,y,z) z1=h*z(x,y,z) x2=h*x(x+x1/2,y+y1/2,z+z1/2) y2=h*y(x+x1/2,y+y1/2,z+z1/2) z2=h*z(x+x1/2,y+y1/2,z+z1/2) x3=h*x(x+x2/2,y+y2/2,z+z2/2) y3=h*y(x+x2/2,y+y2/2,z+z2/2) z3=h*z(x+x2/2,y+y2/2,z+z2/2) x4=h*x(x+x3,y+y3,z+z3) y4=h*y(x+x3,y+y3,z+z3) z4=h*z(x+x3,y+y3,z+z3) x+=(x1+2*x2+2*x3+x4)/6 y+=(y1+2*y2+2*y3+y4)/6 z+=(z1+2*z2+2*z3+z4)/6 print x,,y,,z j+=1 24

25 6 [ ] d 2 φ/dx 2 = ρ φ j+1 2φ j + φ j 1 h 2 = ρ j φ 1 φ 2 φ N 1 φ N = h 2 ρ 1 + φ 0 h 2 ρ 2 h 2 ρ N 1 h 2 ρ N + φ N+1 φ 0, φ N+1 ρ j φ j C: /* poisson.c */ #include <stdio.h> #define N 100 /* tri-diagonal matrix solver */ gauss(double diag[], double sub[], double sup[], double b[], int M){ int j; double t; for(j=0; j<(m-1); j++){ t=sub[j]/diag[j]; diag[j+1] -=t*sup[j]; b[j+1] -=t*b[j]; b[m-1]/=diag[m-1]; for(j=(m-2); j>=0; j--){ b[j]=(b[j]-sup[j]*b[j+1])/diag[j]; main(){ int j; double h=0.01; double diag[n], sup[n-1], sub[n-1], b[n]; double phi[n+2], rho[n+2]; 25

26 /* boundary condition */ phi[0]=0; phi[n+1]=0; for(j=1; j<=n; j++){ rho[j]=1.0; b[j-1]=h*h*rho[j]; /* N-th order matrix */ for(j=0; j<n; j++){ diag[j]=2; for(j=0; j<(n-1); j++){ sub[j]=-1; sup[j]=-1; /* solve */ gauss(diag, sub, sup, b, N); /* output */ for(j=1; j<=n; j++){ phi[j]=b[j-1]; for(j=0; j<=(n+1); j++){ printf("%d %lf\n", j, phi[j]); Java: // poisson.java Perl: # poisson.pl Ruby: #poisson.rb Python: #poisson.py 26

[ ] π = C: /* pi.c $> gcc pi.c -lm $>./a.out */ #include <stdio.h> #include <math.h> main(){ double pi=4*atan(1); printf("%lf\n", pi); # pi=m

[ ] π = C: /* pi.c $> gcc pi.c -lm $>./a.out */ #include <stdio.h> #include <math.h> main(){ double pi=4*atan(1); printf(%lf\n, pi); # pi=m Numerical Rosetta Stone 1 C, Java, Fortran, Perl, Ruby, Python [ ] Hello world C: /* hello.c $> gcc hello.c $>./a.out */ #include main(){ printf("hello world of C!\n"); Java: // hello.java $>

More information

LINUX UNIX Tips Gnuplot 1

LINUX UNIX Tips Gnuplot 1 LINUX UNIX Tips Gnuplot 1 1 1.1 Algebr w al muquabala algebra 1.2 C C Java C 2 [ ] [ ] C Gnuplot C 1. 2. 3. DB WEB 1.3 3 1.4 Hello world! [ 1-1] Hello world! Hello world of C! [ ] C /* hello.c */ #include

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

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

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

[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

1 28 6 12 7 1 7.1...................................... 2 7.1.1............................... 2 7.1.2........................... 2 7.2...................................... 3 7.3...................................

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

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

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

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println(Hello World); (Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello

More information

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t 7 8, /3/, 5// http://nalab.mind.meiji.ac.jp/~mk/labo/text/furiko/ l (, simple pendulum) m g mlθ (t) = mg sin θ(t) () θ (t) + ω sin θ(t) =, ω := ( m ) ( θ ) sin θ θ θ (t) + ω θ(t) = ( ) ( ) g l θ(t) = C

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

Microsoft Word - keisankigairon.ch doc

Microsoft Word - keisankigairon.ch doc 1000000100001010 1000001000001011 0100001100010010 1010001100001100 load %r1,10 load %r2,11 add %r3,%r1,%r2 store %r3,12 k = i + j ; = > (* 1 2 3 4 5 6 7 8 9 10) 3628800 DO 3 I=1,3 DO3I=1.3 DO3I 1.3

More information

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1 C++ 2018 7 1, 2018 11 4 http://nalab.mind.meiji.ac.jp/~mk/labo/text/nantoka-c++/ 1 C++ C C++ C++ C cpprefjp - C++ 1 C++17 2 2 CUI 2.1 donothing.cpp 1 /* 2 * donothing.cpp 3 */ 4 5 int main() 6 7 return

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

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

Java演習(2) -- 簡単なプログラム --

Java演習(2)   -- 簡単なプログラム -- Java public class Hello Hello (class) (field)... (method)... Java main Hello World(Hello.java) public class Hello { public static void main(string[ ] args) { public() (package) Hello World(Hello.java)

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

10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10

10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) / 10 10/8 2015-10-08 URL : http://webct.kyushu-u.ac.jp, 10/8 1 / 10 10/8 Finder,, 1 1. Finder MAC OS X 2. ( ) MAC OS X Java ( ) 3. MAC OS X Java ( ) 1. 30 2 / 10 10/8 Finder 1 Figure : : Apple.com 2, 3 / 10

More information

応力とひずみ.ppt

応力とひずみ.ppt in yukawa@numse.nagoya-u.ac.jp 2 3 4 5 x 2 6 Continuum) 7 8 9 F F 10 F L L F L 1 L F L F L F 11 F L F F L F L L L 1 L 2 12 F L F! A A! S! = F S 13 F L L F F n = F " cos# F t = F " sin# S $ = S cos# S S

More information

II 1 3 2 5 3 7 4 8 5 11 6 13 7 16 8 18 2 1 1. x 2 + xy x y (1 lim (x,y (1,1 x 1 x 3 + y 3 (2 lim (x,y (, x 2 + y 2 x 2 (3 lim (x,y (, x 2 + y 2 xy (4 lim (x,y (, x 2 + y 2 x y (5 lim (x,y (, x + y x 3y

More information

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 Java (7) 2008-05-20 1 Lesson 5 1.1 5 3 = (1) 1 m 3 /s 1 2 3 10 m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 1.2 java 2 1. 2. 3. 4. 3 2 1.3 i =1, 2, 3 V i (t) 1 t h i (t) i F, k

More information

sim98-8.dvi

sim98-8.dvi 8 12 12.1 12.2 @u @t = @2 u (1) @x 2 u(x; 0) = (x) u(0;t)=u(1;t)=0fort 0 1x, 1t N1x =1 x j = j1x, t n = n1t u(x j ;t n ) Uj n U n+1 j 1t 0 U n j =1t=(1x) 2 = U n j+1 0 2U n j + U n j01 (1x) 2 (2) U n+1

More information

明解Java入門編

明解Java入門編 1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");

More information

[ 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:

[ 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: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

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

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

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow

Java (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) flow Java (5) 1 Lesson 3: 2008-05-20 2 x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java 1.1 10 10 0 1.0 2.0, 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flowrate.dat" 10 8 6 4 2 0 0 5 10 15 20 25 time (s) 1 1

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

c-all.dvi

c-all.dvi III(994) (994) from PSL (9947) & (9922) c (99,992,994,996) () () 2 3 4 (2) 2 Euler 22 23 Euler 24 (3) 3 32 33 34 35 Poisson (4) 4 (5) 5 52 ( ) 2 Turbo 2 d 2 y=dx 2 = y y = a sin x + b cos x x = y = Fortran

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

Taro-数値計算の基礎Ⅱ(公開版)

Taro-数値計算の基礎Ⅱ(公開版) 0. 目次 1. 2 分法 2. はさみうち法 3. 割線法 4. 割線法 ( 2 次曲線近似 ) 5. ニュートン法 ( 接線近似 ) - 1 - 1. 2 分法 区間 [x0,x1] にある関数 f(x) の根を求める 区間 [x0,x1] を xm=(x0+x1)/2 で 2 等分し 区間 [x0,xm],[xm,x1] に分割する f(xm) の絶対値が十分小さい値 eps より小さいとき

More information

Bessel ( 06/11/21) Bessel 1 ( ) 1.1 0, 1,..., n n J 0 (x), J 1 (x),..., J n (x) I 0 (x), I 1 (x),..., I n (x) Miller (Miller algorithm) Bess

Bessel ( 06/11/21) Bessel 1 ( ) 1.1 0, 1,..., n n J 0 (x), J 1 (x),..., J n (x) I 0 (x), I 1 (x),..., I n (x) Miller (Miller algorithm) Bess Bessel 5 3 11 ( 6/11/1) Bessel 1 ( ) 1.1, 1,..., n n J (x), J 1 (x),..., J n (x) I (x), I 1 (x),..., I n (x) Miller (Miller algorithm) Bessel (6 ) ( ) [1] n n d j J n (x), d j I n (x) Deuflhard j= j=.1

More information

Java学習教材

Java学習教材 Java 2016/4/17 Java 1 Java1 : 280 : (2010/1/29) ISBN-10: 4798120987 ISBN-13: 978-4798120980 2010/1/29 1 Java 1 Java Java Java class FirstExample { public static void main(string[] args) { System.out.println("

More information

QR

QR 1 7 16 13 1 13.1 QR...................................... 2 13.1.1............................................ 2 13.1.2..................................... 3 13.1.3 QR........................................

More information

joho09.ppt

joho09.ppt s M B e E s: (+ or -) M: B: (=2) e: E: ax 2 + bx + c = 0 y = ax 2 + bx + c x a, b y +/- [a, b] a, b y (a+b) / 2 1-2 1-3 x 1 A a, b y 1. 2. a, b 3. for Loop (b-a)/ 4. y=a*x*x + b*x + c 5. y==0.0 y (y2)

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2

More information

: 1g99p038-8

: 1g99p038-8 16 17 : 1g99p038-8 1 3 1.1....................................... 4 1................................... 5 1.3.................................. 5 6.1..................................... 7....................................

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

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

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

,. Black-Scholes u t t, x c u 0 t, x x u t t, x c u t, x x u t t, x + σ x u t, x + rx ut, x rux, t 0 x x,,.,. Step 3, 7,,, Step 6., Step 4,. Step 5,,.

,. Black-Scholes u t t, x c u 0 t, x x u t t, x c u t, x x u t t, x + σ x u t, x + rx ut, x rux, t 0 x x,,.,. Step 3, 7,,, Step 6., Step 4,. Step 5,,. 9 α ν β Ξ ξ Γ γ o δ Π π ε ρ ζ Σ σ η τ Θ θ Υ υ ι Φ φ κ χ Λ λ Ψ ψ µ Ω ω Def, Prop, Th, Lem, Note, Remark, Ex,, Proof, R, N, Q, C [a, b {x R : a x b} : a, b {x R : a < x < b} : [a, b {x R : a x < b} : a,

More information

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

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 Appendix A BASIC BASIC Beginner s All-purpose Symbolic Instruction Code FORTRAN COBOL C JAVA PASCAL (NEC N88-BASIC Windows BASIC (1 (2 ( BASIC BASIC download TUTORIAL.PDF http://hp.vector.co.jp/authors/va008683/

More information

RHEA key

RHEA key 2 P (k, )= k e k! 3 4 Probability 0.4 0.35 0.3 0.25 Poisson ( λ = 1) Poisson (λ = 3) Poisson ( λ = 10) Poisson (λ = 20) Poisson ( λ = 30) Gaussian (µ = 1, s = 1) Gaussian ( µ = 3, s = 3) Gaussian (µ =

More information

() x + y + y + x dy dx = 0 () dy + xy = x dx y + x y ( 5) ( s55906) 0.7. (). 5 (). ( 6) ( s6590) 0.8 m n. 0.9 n n A. ( 6) ( s6590) f A (λ) = det(a λi)

() x + y + y + x dy dx = 0 () dy + xy = x dx y + x y ( 5) ( s55906) 0.7. (). 5 (). ( 6) ( s6590) 0.8 m n. 0.9 n n A. ( 6) ( s6590) f A (λ) = det(a λi) 0. A A = 4 IC () det A () A () x + y + z = x y z X Y Z = A x y z ( 5) ( s5590) 0. a + b + c b c () a a + b + c c a b a + b + c 0 a b c () a 0 c b b c 0 a c b a 0 0. A A = 7 5 4 5 0 ( 5) ( s5590) () A ()

More information

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A Java 3 p.1 3 Java Java if for while C 3.1 if Java if C if if ( ) 1 if ( ) 1 else 2 1 1 2 2 1, 2 { Q 3.1.1 1. int n = 2; if (n

More information

A

A A05-132 2010 2 11 1 1 3 1.1.......................................... 3 1.2..................................... 3 1.3..................................... 3 2 4 2.1............................... 4 2.2

More information

ii

ii ii iii 1 1 1.1..................................... 1 1.2................................... 3 1.3........................... 4 2 9 2.1.................................. 9 2.2...............................

More information

r1.dvi

r1.dvi 2006 1 2006.10.6 ( 2 ( ) 1 2 1.5 3 ( ) Ruby Java Java Java ( Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is06/ / ( / @@@ ( 3 ) @@@ : ( ) @@@ (Q&A) ( ) 1 http://www.sodan.ecc.u-tokyo.ac.jp/cgi-bin/qbbs/view.cgi

More information

7. y fx, z gy z gfx dz dx dz dy dy dx. g f a g bf a b fa 7., chain ule Ω, D R n, R m a Ω, f : Ω R m, g : D R l, fω D, b fa, f a g b g f a g f a g bf a

7. y fx, z gy z gfx dz dx dz dy dy dx. g f a g bf a b fa 7., chain ule Ω, D R n, R m a Ω, f : Ω R m, g : D R l, fω D, b fa, f a g b g f a g f a g bf a 9 203 6 7 WWW http://www.math.meiji.ac.jp/~mk/lectue/tahensuu-203/ 2 8 8 7. 7 7. y fx, z gy z gfx dz dx dz dy dy dx. g f a g bf a b fa 7., chain ule Ω, D R n, R m a Ω, f : Ω R m, g : D R l, fω D, b fa,

More information

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player jp/download/player/ URL VMware Plaeyr VMware

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player   jp/download/player/ URL VMware Plaeyr VMware 1 2010 k-okada@jsk.t.u-tokyo.ac.jp http://www.jsk.t.u-tokyo.ac.jp/~k-okada/lecture/ 2010 4 5 Linux 1 Ubuntu Ubuntu Linux 1 Ubuntu Ubuntu 3 1. 1 Ubuntu 2. OS Ubuntu OS 3. OS Ubuntu https://wiki.ubuntulinux.jp/ubuntutips/install/installdualboot

More information

P06.ppt

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

More information

text_08.dvi

text_08.dvi C 8 12 6 6 8 Java (3) 1 8.1 8 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 8.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

More information

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

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 6 Runge-KuttaEular Runge-Kutta Runge-Kutta A( ) f(t, x) dx dt = lim x(t + t) x(t) t 0 t = f(t, x) (14) t x x(t) t + dt x x(t + dt) Euler 7 t 1 f(t, x(t)) x(t) + f(t + dt, x(t + dt))dt t + dt x(t + dt)

More information

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r,

2017 p vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = 0 (79) J s flux (67) J (79) J( r, t) = k δf δs s( r, 27 p. 47 7 7. vs. TDGL 4 Metropolis Monte Carlo equation of continuity s( r, t) t + J( r, t) = (79) J s flux (67) J (79) J( r, t) = k δf δs s( r, t) t = k δf δs (59) TDGL (8) (8) k s t = [ T s s 3 + ξ

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°(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

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

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 III No (i) (ii) (iii) (iv) (v) (vi) x 2 3xy + 2. (x,y) (1,0) x 2 + y 2 5x 2 y x 2 + y 2. xy x2 + y 2. 2x + y 3 x 2 + y 2 + 5. sin(x 2 + y 2 ). x 2 + y 2 sin(x 2 y + xy 2 ). xy (i) (ii) (iii) 2xy x 2 +

More information

変 位 変位とは 物体中のある点が変形後に 別の点に異動したときの位置の変化で あり ベクトル量である 変位には 物体の変形の他に剛体運動 剛体変位 が含まれている 剛体変位 P(x, y, z) 平行移動と回転 P! (x + u, y + v, z + w) Q(x + d x, y + dy,

変 位 変位とは 物体中のある点が変形後に 別の点に異動したときの位置の変化で あり ベクトル量である 変位には 物体の変形の他に剛体運動 剛体変位 が含まれている 剛体変位 P(x, y, z) 平行移動と回転 P! (x + u, y + v, z + w) Q(x + d x, y + dy, 変 位 変位とは 物体中のある点が変形後に 別の点に異動したときの位置の変化で あり ベクトル量である 変位には 物体の変形の他に剛体運動 剛体変位 が含まれている 剛体変位 P(x, y, z) 平行移動と回転 P! (x + u, y + v, z + w) Q(x + d x, y + dy, z + dz) Q! (x + d x + u + du, y + dy + v + dv, z +

More information

ープのロープ長以下であれば実現可能である ケース 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,

ープのロープ長以下であれば実現可能である ケース 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, ACM ICPC2013 国内予選問題 E つながれた風船 風船が最も高くあがるケースとして 1. 一本のロープが垂直に延びて他の2 本は緩んでいる 2. 二本のロープがピンと張っており残りの1 本は緩んでいる 3. 三本のロープともピンとはっているの三つのケースが考えられる ロープの本数は高々 10 本なので ケース1 は高々 10 9C2=360 通り ケース2も高々 10C2 8=360 通り

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

デジタル表現論・第4回

デジタル表現論・第4回 デジタル表現論 第 4 回 劉雪峰 ( リュウシュウフォン ) 2016 年 5 月 2 日 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 1 / 14 本日の目標 Java プログラミングの基礎 出力の復習 メソッドの定義と使用 劉 雪峰 ( リュウシュウフォン ) デジタル表現論 第 4 回 2016 年 5 月 2 日 2 / 14 出力 Systemoutprint()

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

meiji_resume_1.PDF

meiji_resume_1.PDF β β β (q 1,q,..., q n ; p 1, p,..., p n ) H(q 1,q,..., q n ; p 1, p,..., p n ) Hψ = εψ ε k = k +1/ ε k = k(k 1) (x, y, z; p x, p y, p z ) (r; p r ), (θ; p θ ), (ϕ; p ϕ ) ε k = 1/ k p i dq i E total = E

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 74 searching 3 key Fig.3-1 75 2を探索 53を探索 3-1 5 2 1 4 3 7 4 を探索 Fig.3-1 76 3 linear searchsequential search 2 Fig.3-2 0 ❶ ❷ ❸ 配列の要素を先頭から順に走査していく 探索すべき値と等しい要素を発見 Fig.3-2 6 4 3 2 3-2Fig.3-3 77 5 Fig.3-3 0

More information

: : : TSTank 2

: : : TSTank 2 Java (8) 2008-05-20 Lesson6 Lesson5 Java 1 Lesson 6: TSTank1, TSTank2, TSTank3 java 2 car1 car2 Car car1 = new Car(); Car car2 = new Car(); car1.setcolor(red); car2.setcolor(blue); car2.changeengine(jet);

More information

1.2 y + P (x)y + Q(x)y = 0 (1) y 1 (x), y 2 (x) y 1 (x), y 2 (x) (1) y(x) c 1, c 2 y(x) = c 1 y 1 (x) + c 2 y 2 (x) 3 y 1 (x) y 1 (x) e R P (x)dx y 2

1.2 y + P (x)y + Q(x)y = 0 (1) y 1 (x), y 2 (x) y 1 (x), y 2 (x) (1) y(x) c 1, c 2 y(x) = c 1 y 1 (x) + c 2 y 2 (x) 3 y 1 (x) y 1 (x) e R P (x)dx y 2 1 1.1 R(x) = 0 y + P (x)y + Q(x)y = R(x)...(1) y + P (x)y + Q(x)y = 0...(2) 1 2 u(x) v(x) c 1 u(x)+ c 2 v(x) = 0 c 1 = c 2 = 0 c 1 = c 2 = 0 2 0 2 u(x) v(x) u(x) u (x) W (u, v)(x) = v(x) v (x) 0 1 1.2

More information

,,,,., C Java,,.,,.,., ,,.,, i

,,,,., C Java,,.,,.,., ,,.,, i 24 Development of the programming s learning tool for children be derived from maze 1130353 2013 3 1 ,,,,., C Java,,.,,.,., 1 6 1 2.,,.,, i Abstract Development of the programming s learning tool for children

More information

P05.ppt

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

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

or a 3-1a (0 b ) : max: a b a > b result a result b ( ) result Python : def max(a, b): if a > b: result = a else: result = b ret

or a 3-1a (0 b ) : max: a b a > b result a result b ( ) result Python : def max(a, b): if a > b: result = a else: result = b ret 4 2018.10.18 or 1 1.1 3-1a 3-1a (0 b ) : max: a b a > b result a result b result Python : def max(a, b): if a > b: result = a result = b return(result) : max2: a b result a b > result result b result 1

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

num2.dvi

num2.dvi kanenko@mbk.nifty.com http://kanenko.a.la9.jp/ 16 32...... h 0 h = ε () 0 ( ) 0 1 IEEE754 (ieee754.c Kerosoft Ltd.!) 1 2 : OS! : WindowsXP ( ) : X Window xcalc.. (,.) C double 10,??? 3 :, ( ) : BASIC,

More information

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 +

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 + 7 7.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave T > 0 t 44.1 khz t = 1 44100 j t f j {f 0, f 1, f 2,, f 1 = T t 7.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1,

More information

II No.01 [n/2] [1]H n (x) H n (x) = ( 1) r n! r!(n 2r)! (2x)n 2r. r=0 [2]H n (x) n,, H n ( x) = ( 1) n H n (x). [3] H n (x) = ( 1) n dn x2 e dx n e x2

II No.01 [n/2] [1]H n (x) H n (x) = ( 1) r n! r!(n 2r)! (2x)n 2r. r=0 [2]H n (x) n,, H n ( x) = ( 1) n H n (x). [3] H n (x) = ( 1) n dn x2 e dx n e x2 II No.1 [n/] [1]H n x) H n x) = 1) r n! r!n r)! x)n r r= []H n x) n,, H n x) = 1) n H n x) [3] H n x) = 1) n dn x e dx n e x [4] H n+1 x) = xh n x) nh n 1 x) ) d dx x H n x) = H n+1 x) d dx H nx) = nh

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション オブジェクト指向 プログラミング演習 第 2 回クラス インスタンス メソッド フィールド コンストラクタ ICPC の宣伝 国際大学対抗プログラミングコンテスト 3 人一組のチームでプログラムを書く速さを競う 国内予選 : ネットワーク上で 6 月末 ~7 月頭 アジア地区予選 : 日本国内で秋に開催 世界大会 :2020 年は 6 月にモスクワで 参加登録締切 : 国内予選の 2~3 週間前 今年は

More information

数値計算法

数値計算法 12.1 電気回路網に関するキルヒホッフの法則による解法 1 工学的諸問題を多元連立 1 次方程式で表現することができる. 例えば, 荷物を最短の時間と最低のコストで輸送するためにはどのようなルートで物流を行うか という問題, 工場の部品の在庫の状況からいかに最小のコストで製品をつくるか という問題, 機械要素の運動の問題, 電気回路の解析の問題など, いくつか挙げられる. つまり, 計算機で多元連立方程式を解くことができれば,

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

新・明解Javaで学ぶアルゴリズムとデータ構造

新・明解Javaで学ぶアルゴリズムとデータ構造 第 3 章 探索 Arrays.binarySearch 743 3-1 探索 探索 searching key 配列 探索 Fig.3-1 b c 75 a 6 4 3 2 1 9 8 2 b 64 23 53 65 75 21 3-1 53 c 5 2 1 4 3 7 4 Fig.3-1 a 763 3-2 線形探索 線形探索 linear search sequential search 2

More information

1 I 1.1 ± e = = - = C C MKSA [m], [Kg] [s] [A] 1C 1A 1 MKSA 1C 1C +q q +q q 1

1 I 1.1 ± e = = - = C C MKSA [m], [Kg] [s] [A] 1C 1A 1 MKSA 1C 1C +q q +q q 1 1 I 1.1 ± e = = - =1.602 10 19 C C MKA [m], [Kg] [s] [A] 1C 1A 1 MKA 1C 1C +q q +q q 1 1.1 r 1,2 q 1, q 2 r 12 2 q 1, q 2 2 F 12 = k q 1q 2 r 12 2 (1.1) k 2 k 2 ( r 1 r 2 ) ( r 2 r 1 ) q 1 q 2 (q 1 q 2

More information

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

1. A0 A B A0 A : A1,...,A5 B : B1,...,B 1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 3. 4. 5. A0 A B f : A B 4 (i) f (ii) f (iii) C 2 g, h: C A f g = f h g = h (iv) C 2 g, h: B C g f = h f g = h 4 (1) (i) (iii) (2) (iii) (i) (3) (ii) (iv) (4)

More information

(x, y) 2. OK NG1 1

(x, y) 2. OK NG1 1 12 22 1. (x, y) 2. OK NG1 1 12 22 / sample program for a Information class DATE: 2014-12-22 convert angle unit, from radian to degree / #include / for printf() / #include / for atan2()

More information

1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 5 3. 4. 5. A0 (1) A, B A B f K K A ϕ 1, ϕ 2 f ϕ 1 = f ϕ 2 ϕ 1 = ϕ 2 (2) N A 1, A 2, A 3,... N A n X N n X N, A n N n=1 1 A1 d (d 2) A (, k A k = O), A O. f

More information

Microsoft PowerPoint pptx

Microsoft PowerPoint pptx PFCore(RT ミドルウェア ) トレーニング中級編 10:00-11:00 第 1 部 :RT コンポーネントプログラミングの概要 担当 : 安藤慶昭 ( 産業技術総合研究所 ) 概要 :RT コンポーネントの作成方法, 設計時の注意点などの概要について解説します 第 2 部 :RT ミドルウェア (PFcore) 開発支援ツールと RT コンポーネントの作成方法 11:00-12:00 12:00-13:00

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java

More information

新・明解Java入門

新・明解Java入門 第 1 章 画面 文字 表示 Java Java Java Java Java JRE Java JDK 21 1-1 Java Java Java Java 誕生 Fig.1-1 Oak Java Sun Microsystems 2010 Oracle Java Oracle 4 Java http://www.java.com/ http://www.alice.org/ Fig.1-1Java

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

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61

More information

z f(z) f(z) x, y, u, v, r, θ r > 0 z = x + iy, f = u + iv C γ D f(z) f(z) D f(z) f(z) z, Rm z, z 1.1 z = x + iy = re iθ = r (cos θ + i sin θ) z = x iy

z f(z) f(z) x, y, u, v, r, θ r > 0 z = x + iy, f = u + iv C γ D f(z) f(z) D f(z) f(z) z, Rm z, z 1.1 z = x + iy = re iθ = r (cos θ + i sin θ) z = x iy z fz fz x, y, u, v, r, θ r > z = x + iy, f = u + iv γ D fz fz D fz fz z, Rm z, z. z = x + iy = re iθ = r cos θ + i sin θ z = x iy = re iθ = r cos θ i sin θ x = z + z = Re z, y = z z = Im z i r = z = z

More information

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

Windows (L): D:\jyugyou\ D:\jyugyou\ D:\jyugyou\ (N): en2 OK 2

Windows (L): D:\jyugyou\ D:\jyugyou\ D:\jyugyou\ (N): en2 OK 2 Windows C++ Microsoft Visual Studio 2010 C++ Microsoft C++ Microsoft Visual Studio 2010 Microsoft Visual Studio 2010 C++ C C++ Microsoft Visual Studio 2010 Professional Professional 1 Professional Professional

More information

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:

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: BASIC 20 4 10 0 N88 Basic 1 0.0 N88 Basic..................................... 1 0.1............................................... 3 1 4 2 5 3 6 4 7 5 10 6 13 7 14 0 N88 Basic 0.0 N88 Basic 0.1: N88Basic

More information

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

1. A0 A B A0 A : A1,...,A5 B : B1,...,B 1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 3. 4. 5. A0 A, B Z Z m, n Z m n m, n A m, n B m=n (1) A, B (2) A B = A B = Z/ π : Z Z/ (3) A B Z/ (4) Z/ A, B (5) f : Z Z f(n) = n f = g π g : Z/ Z A, B (6)

More information

DOPRI5.dvi

DOPRI5.dvi ODE DOPRI5 ( ) 16 3 31 Runge Kutta Dormand Prince 5(4) [1, pp. 178 179] DOPRI5 http://www.unige.ch/math/folks/hairer/software.html Fortran C C++ [3, pp.51 56] DOPRI5 C cprog.tar % tar xvf cprog.tar cprog/

More information

I 4 p.2 4 GUI java.awt.event.* import /* 1 */ import mouseclicked MouseListener implement /* 2 */ init addmouselistener(this) this /* 3 */ this mousec

I 4 p.2 4 GUI java.awt.event.* import /* 1 */ import mouseclicked MouseListener implement /* 2 */ init addmouselistener(this) this /* 3 */ this mousec I 4 p.1 4 GUI GUI GUI 4.1 4.1.1 MouseTest.java /* 1 */ public class MouseTest extends JApplet implements MouseListener /* 2 */ { int x=50, y=20; addmouselistener(this); /* 3 */ public void mouseclicked(mouseevent

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

6

6 000 (N =000) 50 ( N(N ) / = 499500) μm.5 g cm -3.5g cm 3 ( 0 6 µm) 3 / ( g mo ) ( 6.0 0 3 mo ) =.3 0 0 0 5 (0 6 ) 0 6 0 6 ~ 0 000 000 ( 0 6 ) ~ 0 9 q R q, R q q E = 4πε 0 R R (6.) -6 (a) (b) (c) (a) (b)

More information

データ構造とアルゴリズム論

データ構造とアルゴリズム論 15 12 2 (n-1)(n-2) n Fact(n) factorial Fact Fact(n) X XX*i X1 i:1,1,n Fact(n) AnsFact(n) Ans 123 15 12 2 6-8 void jbuttonkeisan actionperformed(actionevent e) { int Ans,n; n=integer.parseint(jtextfieldn.gettext())

More information

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

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 6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = t 44.1 khz t = 1 sec 44100 j t f j {f 0, f 1, f 2,, f 1 6.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1, 2,,

More information