Python Speed Learning

Size: px
Start display at page:

Download "Python Speed Learning"

Transcription

1 Python Speed Learning 1 / 76

2 Python 2 1 $ python 1 >>> / 76

3 print : 1 print : ( ) 3 / 76

4 print : 1 print 1 2 print hello 3 print print 7/3 5 print abs(-5*4) 4 / 76

5 print : 1 print 1 2 print hello 3 print print 7/3 5 print abs(-5*4) : hello / 76

6 ,, (/) 7 / / / float(3) / 76

7 : 1 = : ( ; variable), 6 / 76

8 :?, python? 1 a = print a 3 b = a print b 5 a = a print a 7 / 76

9 :?, python? 1 a = print a 3 b = a print b 5 a = a print a : / 76

10 ... : 1 a = print a 3 print b 8 / 76

11 ... : 1 a = print a 3 print b : Traceback (most recent call last): 3 File "a.py", line 3, in <module> 4 print b 5 NameError: name b is not defined 8 / 76

12 :.,, ( ),., 1. : x, y, tanaka, Kouji Uehara, World Cup 2013 : J-League, hungry?, 4WD 9 / 76

13 : 1 def (,,...): : 10 / 76

14 : 1 # 2 def f(x, y): 3 a = x + y 4 return a * a 5 6 # ( ) 7 print f(10, 20) / 76

15 : 1 # 2 def f(x, y): 3 a = x + y 4 return a * a 5 6 # ( ) 7 print f(10, 20) + 30 : / 76

16 python, 1 def f(x, y): 2 a = x + y 3 return a * a 4 print f(10, 20) f ( ) 2 print. 1,f(10, 20) , f(10, 20) x=10, y=20 f 3 return : 1 return,, 12 / 76

17 :?, python? 1 def f(x, y): 2 print 1 3 print hello 13 / 76

18 :?, python? 1 def f(x, y): 2 print 1 3 print hello! 13 / 76

19 :? 1 def f(x, y): 2 print x 3 print y 4 return x + y 5 6 print f(10, 20) 14 / 76

20 :? 1 def f(x, y): 2 print x 3 print y 4 return x + y 5 6 print f(10, 20) / 76

21 :? : 1 def f(x, y): 2 print x 3 print y 4 x + y 5 6 print f(10, 20) 15 / 76

22 :? : 1 def f(x, y): 2 print x 3 print y 4 x + y 5 6 print f(10, 20) : None 15 / 76

23 :? : 1 def f(x, y): 2 print x 3 print y 4 x + y 5 6 print f(10, 20) : None (return ). return,,, None 15 / 76

24 :? : 1 def f(x, y): 2 print x 3 print y 4 x + y 5 6 print f(10, 20) / 76

25 :? : 1 def f(x, y): 2 print x 3 print y 4 x + y 5 6 print f(10, 20) + 30 : Traceback (most recent call last): 4 File "a.py", line 6, in <module> 5 TypeError: unsupported operand type(s) for +: NoneType and int 16 / 76

26 :? : 1 def f(x, y): 2 print x 3 print y 4 x + y 5 6 print f(10, 20) + 30 None, 30, : Traceback (most recent call last): 4 File "a.py", line 6, in <module> 5 TypeError: unsupported operand type(s) for +: NoneType and int 16 / 76

27 1 def f(x, y): 2 print hello 3 print bye 4 print 10 5 f(30, 40) 17 / 76

28 1 def f(x, y): 2 print hello 3 print bye 4 print 10 5 f(30, 40) hello 3 bye print hello, print bye f ( ) print 10 f f(30,40), print hello, print bye 17 / 76

29 Python 1 def f(x): 2 print x 3 print x+1 1 File "a.py", line 3 2 print x+1 3 ^ 4 IndentationError: unexpected indent 18 / 76

30 Python 1 print 10 2 def f(x): 3 print x 4 5 print 20 1 File "a.py", line 5 2 print 20 3 ^ 4 IndentationError: unindent does not match any outer indentation level 19 / 76

31 Emacs Emacs Python (xxx.py), Tab ( C-i), Tab, 20 / 76

32 1 def f(x): 2 print x 3 y = x return y * y 5 def g(x): 6 y = f(x + 1) 7 print x 8 return x + y 9 print g(10) 21 / 76

33 1 def f(x): 2 print x 3 y = x return y * y 5 def g(x): 6 y = f(x + 1) 7 print x 8 return x + y 9 print g(10) / 76

34 ,. : 1 def f(x, y): 2 return x - y 3 4 print f(2, 3) # x=2, y=3, x, y 1 print f(y=10, x=20), 22 / 76

35 ,, ( ) 1 def g(x, y=1): 2 return x - y 3 4 print g(2) # x=2, y=1 5 print g(x=2) # x=2, y=1 6 print g(2, 3) # x=2, y=3 7 print g(x=2, y=3) # x=2, y=3 8 print g(y=3) # NG x Visual Python, numpy, 23 / 76

36 : 1 def f(x): 2 print x 3 y = x return y * y 5 def g(x): 6 y = f(x + 1) 7 print x 8 return x + y 9 print g(10), f x (y) g x (y),?. ( ) ( ) 24 / 76

37 1 def f(x): 2 y = x f(10) 4 print y : 1 Traceback (most recent call last): 2 File "a.py", line 5, in <module> 3 print y 4 NameError: name y is not defined 25 / 76

38 ( ), 1 z = 10 2 def f(x): 3 return x + z 4 print f(20) 5 z = 30 6 print f(20) 26 / 76

39 ( ), 1 z = 10 2 def f(x): 3 return x + z 4 print f(20) 5 z = 30 6 print f(20) : , ( ) 26 / 76

40 import : 1 from import * : 27 / 76

41 import : 1 print cos(0.1) : 1 Traceback (most recent call last): 2 File "a.py", line 1, in <module> 3 print cos(0.1) 4 NameError: name cos is not defined : 1 from math import * # math import 2 print cos(0.1) : / 76

42 import : 1 from visual import * 2 sphere() : 29 / 76

43 import : 1 import : from import *,,. 1 import visual 2 visual.sphere(), OK, 30 / 76

44 Python Python Visual Python, Matplotlib, numpy? ( )? python, dir( ) 1 from visual import * 2 print dir(visual) 1 [ ALLOW_THREADS, BUFSIZE, sphere,... ] 31 / 76

45 print (print ) ( = ) (def...) return (return ) import (from import *) 32 / 76

46 , ( ) 33 / 76

47 for (1) ( ): 1 for in range(, ): : 1 for i in range(a, b): , i = a, a + 1,..., b 1,... : range( ) range(0, ) 34 / 76

48 for (1) : 1 1 for x in range(3, 7): 2 print x * x 35 / 76

49 for (1) : 1 1 for x in range(3, 7): 2 print x * x / 76

50 for (1) : 2 1 def hatena(n): 2 a = 1 3 for i in range(0, n): 4 a = 2 * a return a 6 print hatena(5) 36 / 76

51 for (1) : 2 1 def hatena(n): 2 a = 1 3 for i in range(0, n): 4 a = 2 * a return a 6 print hatena(5) / 76

52 for (1) : 3 1 def hatena(n): 2 s = 0 3 for i in range(0, n): 4 s = s + i * i 5 return s 6 print hatena(8) (n 1) 2 s = s + i i / 76

53 for (1) : 3 1 def hatena(n): 2 s = 0 3 for i in range(0, n): 4 s = s + i * i 5 return s 6 print hatena(8) (n 1) 2 s = s + i i / 76

54 if : 1 if 1: elif: 2: else: elif. elif, else: ( ) : 1 (0) ( 1...) 2 (0) 2 ( 2...) 38 / 76

55 if (1) 1 def one_two_many(x): 2 if x == 1: 3 return ikko 4 elif x == 2: 5 return niko 6 else: 7 return takusan 8 print one_two_many(2) 9 print one_two_many(3) 39 / 76

56 if (1) 1 def one_two_many(x): 2 if x == 1: 3 return ikko 4 elif x == 2: 5 return niko 6 else: 7 return takusan 8 print one_two_many(2) 9 print one_two_many(3) 1 niko 2 takusan 39 / 76

57 if (2) 1 def nabetsune(): 2 for i in range(1, 41): 3 if i % 3 == 0 or i % 10 == 3 or 30 < i < 40: 4 print i, "!!!!!" 5 else: 6 print i 7 8 nabetsune() 40 / 76

58 if (2) 1 def nabetsune(): 2 for i in range(1, 41): 3 if i % 3 == 0 or i % 10 == 3 or 30 < i < 40: 4 print i, "!!!!!" 5 else: 6 print i 7 8 nabetsune() !!! / 76

59 ,, (e.g.,,,,,,... ),, ( ) 41 / 76

60 : 1 [,,..., ] : ( ) 42 / 76

61 : 1 from math import * 2 x = 20 3 a = [ 1, 1+2, cos(0.0), x ] 4 print a 5 print len(a) # 6 print a[2] # 7 b = a + [ 1.2, 3.4 ] # 2 8 print b 9 c = [ a, a, a ] # 10 print c[1][2] # c 1 ( ) 2 1 [1, 3, 1.0, 20] [1, 3, 1.0, 20, 1.2, 3.4] / 76

62 :,,,,,, 1 def f(l): 2 return l[0] 3 4 print f([1,2,3]) 44 / 76

63 ,, 1 a = [ 2, 3, 5 ] 2 a.append(7) # 3 a[2] = 50 4 del a[1] # a[1]. 5 b = [ a, a, a ] 6 print b 7 a[2] = 30 # 8 print b 1 [[2, 50, 7], [2, 50, 7], [2, 50, 7]] 2 [[2, 30, 7], [2, 30, 7], [2, 30, 7]] 45 / 76

64 for : 1 [ for in range(, ) ], for ( ) : ( for in ) 46 / 76

65 : 1 >>> [ x * x for x in range(0, 5) ] 2 -> [0, 1, 4, 9, 16] 1 >>> sum([ x * x for x in range(0, 5) ]) 2 -> 30 1 s = [] 2 for x in range(0, 5): 3 s.append(x * x) 1 s = [] 2 for x in range(0, 5): 3 s += x * x ( : s += E s = s + E ) 47 / 76

66 : 1,,...,, 1 (,,..., ) :!, len(...) ( )...[...] ( ) ( ) 48 / 76

67 ,,, 1 a = (1.1, 2.2, 3.3) 2 a.append(4.4) # NG 3 del a[1] # NG 4 a[1] = 22 # NG 5 a = (4.4, 5.5) # OK 6 a = a + (6.6, 7.7) # OK 2, 49 / 76

68 1 def polar(x, y): 2 r = sqrt(x * x + y * y) 3 theta = atan2(y, x) 4 return (r,theta) 1 r,theta = polor(3, 4)? OK 1 [a0,a1,a2] = range(3,6) # a0=3, a1=4, a2=5 50 / 76

69 : 1 "... " """... """ 4....? ",. a = he greeted, "hi" b = "Obama s lecture" 3 (""", ),, len(...)...[...] / 76

70 : ( ) x, 1 print x,, 1 print "x = %s" % x 1 from math import * 2 y = cos(3.14) 3 print "cos(3.14) = %s" % y 52 / 76

71 : 2 2, % 1 from math import * 2 x = print "cos(%s) = %s" % (x, exp(x)) 53 / 76

72 :, 1 1 % 2, 1, 1 i %s, 2 i %s,, %s... %d : %9d :. 9 9 %f : %.3f :., 3 54 / 76

73 (1) Python,,, (visual vector, numpy ), Python 5 55 / 76

74 (2) Python,,, (, ),,, +, len, [...] numpy Visual Python vector, 56 / 76

75 for (2) : 1 for in : ,, range(a, b),,,,, range(a, b) [ a, a + 1,...b 1 ] 57 / 76

76 for (2) : 1 for x in [ 2, 3, 5 ]: 2 print x 3 for x in "hello": 4 print x h 5 e 6 l 7 l 8 o 58 / 76

77 for (2) 1 A = [ (0,1), (2,3), (4, 5) ] 2 for x,y in A: 3 print x + y / 76

78 for (2) : zip zip(x, Y ) for 1 X = [ 1, 2, 3 ] 2 Y = [ 1, 4, 9 ] 3 for x,y in zip(x, Y): 4 print x + y / 76

79 for (2) : enumerate enumerate(l) ( ; 0, 1, 2,... ) 1 def find_space(): 2 for i,c in enumerate("hello world"): 3 if c == : 4 return i 5 return / 76

80 while : (for ) break : for, while continue : for, while ( ), Python 4 62 / 76

81 : Python,, etc. 63 / 76

82 : 1 class : : ( ), 64 / 76

83 : 1 class nothing: 2 pass # 3 4 # nothing 5 m = nothing() 6 # ( ) 7 m.x = 10 8 m.y = 20 9 # 10 print m.x + m.y 11 # def take_nothing(n): 14 n.x = n.x take_nothing(m) 17 print m.x 65 / 76

84 : init, ( ) ( self ) 1 class baseball_team: 2 # 3 def init (self, name, manager, players): 4 self.name = name 5 self.manager = manager 6 self.players = players 7 # 8 def add_player(self, p): 9 self.players.append(p) 66 / 76

85 : 1 # -> init 2 r = baseball team("nipponham", "Kuriyama", 3 [ "Inaba", "Saito", "Takeda" ]) 4 print r.players 5 # 6 r.add player("ohtani") 7 print r.players 67 / 76

86 : 1 # -> init 2 r = baseball team("nipponham", "Kuriyama", 3 [ "Inaba", "Saito", "Takeda" ]) 4 print r.players 5 # 6 r.add player("ohtani") 7 print r.players 1 [ "Inaba", "Saito", "Takeda" ] 2 [ "Inaba", "Saito", "Takeda", "Ohtani" ] 67 / 76

87 ,,, Visual Python, numpy,,, (, ) (vector, sphere, + ) 1 center = vector(2, 3, 4) 2 s = sphere(pos=center) 3 s.pos = center + vector(1, 1, 1) 68 / 76

88 add (self, o), (+) x + y, x. add (y) 1 class vector: 2 def init (self, x, y, z): 3 self.x = x 4 self.y = y 5 self.z = z 6 def add (self, o): 7 return vector(self.x + o.x, self.y + o.y, 8 self.z + o.z) 9 10 u = vector(1,2,3) 11 v = u + vector(4, 5, 6) # u. add (vector(4, 5, 6)) 12 print v, sub, mul, div 69 / 76

89 Python, +, -, *,, Python, ( ), Visual Python vector ( ), numpy array, mat,,, vector, + 70 / 76

90 Visual Python 1 from visual import * 2 s1 = sphere(color=color.red) # 3 s2 = sphere(pos=vector(1.0, 2.0, 3.0), radius=0.1) 4 # s1, s2 5 rate(0.3) # 3.3 (0.3 / ) 6 # 7 s2.color = color.green # 8 rate(0.3) # 3.3 (0.3 / ) 9 s2.pos = s2.pos * vector(-1.0,-1.0,-1.0) # Visual Python sphere, (color, radius, pos ),,, OK (, s1.vel = ) 71 / 76

91 Visual Python 1 from visual import * 2 s1 = sphere(color=color.red) # 3 s2 = sphere(pos=vector(1.0, 2.0, 3.0), radius=0.1) 4 # s1, s2 5 rate(0.3) # 3.3 (0.3 / ) 6 # 7 s2.color = color.green # 8 rate(0.3) # 3.3 (0.3 / ) 9 s2.pos = s2.pos * vector(-1.0,-1.0,-1.0) # Visual Python vector 3 +, * 72 / 76

92 Visual Python vector 1 >>> from visual import * 2 >>> v = vector(1,2,3) 3 >>> v 4 vector(1, 2, 3) 5 >>> v[0] >>> v.x >>> 2 * v 10 vector(2, 4, 6) 11 >>> v + v 12 vector(2, 4, 6) 13 >>> dir(v) 14 [..., astuple, clear, comp, cross, diff_angle, dot, mag, mag2, norm, proj, rotate, x, y, z ] 73 / 76

93 Visual Python vector 1 >>> v.mag >>> v.mag >>> v.dot(v) # >>> v.norm() 8 vector( , , ) 9 >>> v.mag * v.norm() 10 vector(1, 2, 3) 11 >>> v.cross(vector(1,1,1)) # 12 vector(-1, 2, -1) 74 / 76

94 Visual Python 1 from visual import * 2 s1 = sphere(color=color.red) # 3 s2 = sphere(pos=vector(1.0, 2.0, 3.0), radius=0.1) 4 # s1, s2 5 rate(0.3) # 3.3 (0.3 / ) 6 # 7 s2.color = color.green # 8 rate(0.3) # 3.3 (0.3 / ) 9 s2.pos = s2.pos * vector(-1.0,-1.0,-1.0) # Visual Python rate(f),, f / ( 1/f ) rate, ( ) 75 / 76

95 ( ), Python, # 1 def main(): 2 # location of the pointmass 3 p = vector(1,2,3) 4 # the pointmass 5 s = sphere(pos=p) 6 # the spring 7 sp = helix(pos=p) 8..., 1 1 #! -*- coding: utf-8 -*- 76 / 76

Python Speed Learning

Python   Speed Learning Python Speed Learning 1 / 89 1 2 3 4 (import) 5 6 7 (for) (if) 8 9 10 ( ) 11 12 for 13 2 / 89 Contents 1 2 3 4 (import) 5 6 7 (for) (if) 8 9 10 ( ) 11 12 for 13 3 / 89 (def) (for) (if) etc. 1 4 / 89 Jupyter

More information

Visual Python, Numpy, Matplotlib

Visual Python, Numpy, Matplotlib Visual Python, Numpy, Matplotlib 1 / 38 Contents 1 2 Visual Python 3 Numpy Scipy 4 Scipy 5 Matplotlib 2 / 38 Contents 1 2 Visual Python 3 Numpy Scipy 4 Scipy 5 Matplotlib 3 / 38 3 Visual Python: 3D Numpy,

More information

Visual Python, Numpy, Matplotlib

Visual Python, Numpy, Matplotlib Visual Python, Numpy, Matplotlib 1 / 57 Contents 1 2 Visual Python 3 Numpy Scipy 4 Scipy 5 Matplotlib 2 / 57 Contents 1 2 Visual Python 3 Numpy Scipy 4 Scipy 5 Matplotlib 3 / 57 3 Visual Python: 3D Numpy,

More information

listings-ext

listings-ext (6) Python (2) ( ) [email protected] 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1

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

num2.dvi

num2.dvi [email protected] 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

PYTHON 資料 電脳梁山泊烏賊塾 PYTHON 入門 ゲームプログラミング スプライトの衝突判定 スプライトの衝突判定 スプライトの衝突判定の例として インベーダーゲームのコードを 下記に示す PYTHON3 #coding: utf-8 import pygame from pygame.lo

PYTHON 資料 電脳梁山泊烏賊塾 PYTHON 入門 ゲームプログラミング スプライトの衝突判定 スプライトの衝突判定 スプライトの衝突判定の例として インベーダーゲームのコードを 下記に示す PYTHON3 #coding: utf-8 import pygame from pygame.lo PYTHON 入門 ゲームプログラミング スプライトの衝突判定 スプライトの衝突判定 スプライトの衝突判定の例として インベーダーゲームのコードを 下記に示す #coding: utf-8 import pygame from pygame.locals import * import os import sys SCR_RECT = Rect(0, 0, 640, 480) def main():

More information

haskell.gby

haskell.gby Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]

More information

RL_tutorial

RL_tutorial )! " = $ % & ' "(& &*+ = ' " + %' "(- + %. ' "(. + γ γ=0! " = $ " γ=0.9! " = $ " + 0.9$ " + 0.81$ "+, + ! " #, % #! " #, % # + (( + #,- +. max 2 3! " #,-, % 4! " #, % # ) α ! " #, % ' ( )(#, %)!

More information

cards.gif from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height = 300) c0.pack() image_data = PhotoImage(file = c1.gif ) c0.create_i

cards.gif from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height = 300) c0.pack() image_data = PhotoImage(file = c1.gif ) c0.create_i (Python ) Python Python 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. Python http://www.jftz.com/cards/ 1 cards.gif from Tkinter import * root = Tk() c0 = Canvas(root,

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

from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height = 300) c0.pack() image_data = PhotoImage(file = c1.gif ) c0.create_image(200,

from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height = 300) c0.pack() image_data = PhotoImage(file = c1.gif ) c0.create_image(200, (Python ) Python Python 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. Python.gif 1 from Tkinter import * root = Tk() c0 = Canvas(root, width = 400, height =

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

Python C/C++ IPMU IRAF

Python C/C++ IPMU IRAF Python C/C++ IPMU 2010 11 24IRAF Python Swig Numpy array Image Python 2.6.6 swig 1.3.40 numpy 1.5.0 pyfits 2.3 pyds9 1.1 svn co hjp://svn.scipy.org/svn/numpy/tags/1.5.0/doc/swig swig/numpy.i /usr/local/share/swig/1.3.40/python

More information

nakao

nakao Fortran+Python 4 Fortran, 2018 12 12 !2 Python!3 Python 2018 IEEE spectrum https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2018!4 Python print("hello World!") if x == 10: print

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

1 matplotlib matplotlib Python matplotlib numpy matplotlib Installing A 2 pyplot matplotlib 1 matplotlib.pyplot matplotlib.pyplot plt import import nu

1 matplotlib matplotlib Python matplotlib numpy matplotlib Installing A 2 pyplot matplotlib 1 matplotlib.pyplot matplotlib.pyplot plt import import nu Python Matplotlib 2016 ver.0.06 matplotlib python 2 3 (ffmpeg ) Excel matplotlib matplotlib doc PDF 2,800 python matplotlib matplotlib matplotlib Gallery Matplotlib Examples 1 matplotlib 2 2 pyplot 2 2.1

More information

Windows [ ] [ (R)..] cmd [OK] Z:\> mkdir progi [Enter] \ ) mkdir progi ) (command ) help [Enter] help ( help ) mkdir make directory Windows ) mkdir mk

Windows [ ] [ (R)..] cmd [OK] Z:\> mkdir progi [Enter] \ ) mkdir progi ) (command ) help [Enter] help ( help ) mkdir make directory Windows ) mkdir mk Ruby I I 1 Windows 1 Meadow 1: Meadow I Meadow 2 2 Ruby 2.1 I Z progi 1 Windows [ ] [ (R)..] cmd [OK] Z:\> mkdir progi [Enter] \ ) mkdir progi ) (command ) help [Enter] help ( help ) mkdir make directory

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

Parametric Polymorphism

Parametric Polymorphism ML 2 2011/04/19 Parametric Polymorphism Type Polymorphism ? : val hd_int : int list - > int val hd_bool : bool list - > bool val hd_i_x_b : (int * bool) list - > int * bool etc. let hd_int = function (x

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

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

More information

: Shift-Return evaluate 2.3 Sage? Shift-Return abs 2 abs? 2: abs 3: fac

: Shift-Return evaluate 2.3 Sage? Shift-Return abs 2 abs? 2: abs 3: fac Bulletin of JSSAC(2012) Vol. 18, No. 2, pp. 161-171 : Sage 1 Sage Mathematica Sage (William Stein) 2005 2 2006 2 UCSD Sage Days 1 Sage 1.0 4.7.2 1) Sage Maxima, R 2 Sage Firefox Internet Explorer Sage

More information

Python (Anaconda ) Anaconda 2 3 Python Python IDLE Python NumPy 6

Python (Anaconda ) Anaconda 2 3 Python Python IDLE Python NumPy 6 Python (Anaconda ) 2017. 05. 30. 1 1 2 Anaconda 2 3 Python 3 3.1 Python.......................... 3 3.2 IDLE Python....................... 5 4 NumPy 6 5 matplotlib 7 5.1..................................

More information

Python3 Next 2

Python3 Next 2 Python Python Tkinter Tkinter Python Python Anaconda Python Anaconda Python https://www.continuum.io/downloads Python 3.6 version Python2 Python3 Python 2.7 Python 3.6 Python2 1 Python3 Next 2 I Agree

More information

untitled

untitled 1 2 1 1 2 3 1 2 1 2 4 0,76 4 5 0,1 1970 1974 1993 6 7 8 9 4 1920 10 1960 1971 ( ) IC 11 1980 1990 1992 1987 0,269 1996 0,023 2001 2002 1996 1996 1 98 27 70 1 3 7 12 2003 63 2 13 3 5 1 13 5 14 2 14 2 14

More information

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 September 2016 1 Windows Cygwin Mac *1 Emacs Ruby 1 1.1 ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 ~/16:00:20> ls 2 2 ls ls -a ~/16:00:20> ls -a

More information

:56 1 (Forward kinematics) (Global frame) G r = (X, Y, Z) (Local frame) L r = (x, y, z) 1 X Y, Z X Y, Z 1 ( ) ( ) 1.2 (Joint rotati

:56 1 (Forward kinematics) (Global frame) G r = (X, Y, Z) (Local frame) L r = (x, y, z) 1 X Y, Z X Y, Z 1 ( ) ( ) 1.2 (Joint rotati 2013.09.21 17:56 1 (Forward kinematics) 1.1 2 (Global frame) G r (X, Y, Z) (Local frame) L r (x, y, z) 1 X Y, Z X Y, Z 1 ( ) ( ) 1.2 (Joint rotation) 3 P G r, L r G r L r Z α : G r Q L Z,α r (1) 1 G r

More information

OpenCV IS Report No Report Medical Information System Labratry

OpenCV IS Report No Report Medical Information System Labratry OpenCV 2014 8 25 IS Report No. 2014090201 Report Medical Information System Labratry Abstract OpenCV OpenCV 1............................ 2 1.1 OpenCV.......................... 2 1.2......................

More information

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

1-4 int a; std::cin >> a; std::cout << a =  << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

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

超初心者用

超初心者用 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

# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu

# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu II 4 : 2001 11 7 keywords: 1 OCaml OCaml (first-class value) (higher-order function) 1.1 1 2 + 2 2 + + n 2 sqsum 1 3 + 2 3 + + n 3 cbsum # let rec sqsum n = # if n = 0 then 0 else n * n + sqsum (n - 1)

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

離散数理工学 第 2回 数え上げの基礎:漸化式の立て方

離散数理工学 第 2回  数え上げの基礎:漸化式の立て方 2 [email protected] 2015 10 20 2015 10 18 15:29 ( ) (2) 2015 10 20 1 / 45 ( ) 1 (10/6) ( ) (10/13) 2 (10/20) 3 ( ) (10/27) (11/3) 4 ( ) (11/10) 5 (11/17) 6 (11/24) 7 (12/1) 8 (12/8) ( ) (2) 2015 10 20

More information

たのしいプログラミング Pythonではじめよう!

たのしいプログラミング Pythonではじめよう! Title of English-language original: Python for Kids A Playful Introduction to Programming ISBN 978-1-59327-407-8, published by No Starch Press, Inc. Copyright 2013 by Jason R. Briggs. Japanese-language

More information

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

Microsoft PowerPoint - CproNt02.ppt [互換モード] 第 2 章 C プログラムの書き方 CPro:02-01 概要 C プログラムの構成要素は関数 ( プログラム = 関数の集まり ) 関数は, ヘッダと本体からなる 使用する関数は, プログラムの先頭 ( 厳密には, 使用場所より前 ) で型宣言 ( プロトタイプ宣言 ) する 関数は仮引数を用いることができる ( なくてもよい ) 関数には戻り値がある ( なくてもよい void 型 ) コメント

More information

Jacques Garrigue

Jacques Garrigue Jacques Garrigue Garrigue 1 Garrigue 2 $ print_lines () > for i in $1; do > echo $i > done $ print_lines "a b c" a b c Garrigue 3 Emacs Lisp (defun print-lines (lines) (dolist (str lines) (insert str)

More information

ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1

ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1 More Logic More Types ML/OCaml GADT Jacques Garrigue ( ) Jacques Le Normand (Google) Didier Rémy (INRIA) @garriguejej ocamlgadt ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1 ( ) ML type nebou and

More information

1/8 ページ Java 基礎文法最速マスター Java Javaの文法一覧です 他の言語をある程度知っている人はこれを読めばJavaの基礎をマスターしてJavaを書くことができるようになっています 簡易リファレンスとしても利用できると思いますので これは足りないと思うものがあれば教えてください 1. 基礎 class の作成プログラムはclassに記述します たとえばSampleという名前のclassを作る場合

More information

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

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.   このサンプルページの内容は, 初版 1 刷発行時のものです. Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009631 このサンプルページの内容は, 初版 1 刷発行時のものです. Excel URL http://www.morikita.co.jp/books/mid/009631 i Microsoft Windows

More information

PYTHON 資料 電脳梁山泊烏賊塾 PYTHON 入門 関数とメソッド 関数とメソッド Python には関数 (function) とメソッド (method) が有る モジュール内に def で定義されて居る物が関数 クラス内に def で定義されて居る物がメソッドに成る ( 正確にはクラスが

PYTHON 資料 電脳梁山泊烏賊塾 PYTHON 入門 関数とメソッド 関数とメソッド Python には関数 (function) とメソッド (method) が有る モジュール内に def で定義されて居る物が関数 クラス内に def で定義されて居る物がメソッドに成る ( 正確にはクラスが PYTHON 入門 関数とメソッド 関数とメソッド Python には関数 (function) とメソッド (method) が有る モジュール内に def で定義されて居る物が関数 クラス内に def で定義されて居る物がメソッドに成る ( 正確にはクラスがインスタンス化されてからメソッドに成る ) # 関数 def test_func(): print('call test_func') #

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

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

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

EnSight 10.1の新機能

EnSight 10.1の新機能 EnSight の処理の自動化のためのテクニックのご紹介 CEI ソフトウェア株式会社 松野康幸 2016 年 11 月 4 日 本日の予定 EnSight の処理の自動化に向けて EnSight のコマンドでできること EnSight で利用できるコマンドの種類 コマンド ファイルの作り方 Python 形式のコマンドの作り方作成したコマンド ファイルの実行方法ユーザー定義ツールの作り方ユーザー定義ツールの使い方

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

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

1st-session key

1st-session key 1 2013/11/29 Project based Learning: Soccer Agent Program 1 2012/12/9 Project based Learning: Soccer Agent Program PBL Learning by doing Schedule 1,2 2013 11/29 Make 2013 12/6 2013 12/13 2013 12/20 2014

More information

r1.dvi

r1.dvi Ruby 2009.9.7 1 ( ) --- ( ( ) ( ) 1 --- ( ) 1 ( ) (?) IT 7K( )?? ( ) ( )? IT ( ) --- ( ) 1 ( ) --- ( ) (?) 2-3% Top-Level ICT Professional 5% ICT Professional 10% 100% 50% 20% Devl. Experiment Adv. ICT

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

fp.gby

fp.gby 1 1 2 2 3 2 4 5 6 7 8 9 10 11 Haskell 12 13 Haskell 14 15 ( ) 16 ) 30 17 static 18 (IORef) 19 20 OK NG 21 Haskell (+) :: Num a => a -> a -> a sort :: Ord a => [a] -> [a] delete :: Eq a => a -> [a] -> [a]

More information

Python ( ) Anaconda 2 3 Python Python IDLE Python NumPy 6 5 matpl

Python ( ) Anaconda 2 3 Python Python IDLE Python NumPy 6 5 matpl Python ( ) 2017. 11. 21. 1 1 2 Anaconda 2 3 Python 3 3.1 Python.......................... 3 3.2 IDLE Python....................... 5 4 NumPy 6 5 matplotlib 7 5.1.................................. 7 5.2..................................

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

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