if if-else if-elif-else
|
|
- さあしゃ くだら
- 5 years ago
- Views:
Transcription
1 1 Python SageMath ( ) I Python 1 1 Python (Hello World) Python Python (print) Python (dictionary) (set) e π
2 if if-else if-elif-else if BMI For For for for for (for for ) for 2 if for 3: break ( ) n while while while lambda def
3 Set Set II SageMath SageMath Sage Sage Sage Sage Web Sage SageMathCloud Windows Sage Mac Sage Sage Sage n Sage Sage Sage Sage Sage
4 Sage plot (x, y) ( ) density plot contour plot x == solve find root Sage Taylor Taylor Taylor
5 Euler Riccati, Clairaut, Lagrange (ics) (animate)
6 Python SageMath Sage Sage 100 *1 Python 2 3 Sage Python Python Sage *2 Sage Python2 Python2 Python Sage Windows Mac Linux * * SageMath ver.8.1 6
7 1 PYTHON I Python 1 Python Python 3 (1) Python (2) (3) Sage (3) Sage 1.1 (Hello World) (1) T;GV6U1M"s e{>wn"iôö Ñ c/2y ÿ ***.py ƒžûœé œal Wÿ python ***.py 1 Python (1) Python Emacs (hello.py) Emacs 1 user@debian :~$ cd ~/ Desktop / dataproc1 / # 2 user@debian :~/ Desktop / dataproc1$ emacs hello.py & # E m a c s Emacs C-x C-s dataproc1 hello.py Emacs Python hello.py hello.py 1 print Hello World (C-x C-s) *3 Python *3 Alt+Tab 1
8 1.2 Python 1 PYTHON 1 user@ debian :~/ Desktop / dataproc1$ python hello. py 2 Hello World 3 user@ debian :~/ Desktop / dataproc1$ Hello World Python C 1.2 Python Python utf-8 1 # -*- coding : utf -8 -*- 1 # coding : utf -8 Emacs Python hellojp.py 1 print python hellojp.py sys:1: DeprecationWarning: Non-ASCII character xe3 in file test.py on line 1, but no encoding declared; see for details hellojp.py 1 # -*- coding : utf -8 -*- 2 print python hellojp.py 1.3 Python # *4 1 print Hello World # *4 LATEX % 2
9 1.4 Python Python Python python [ENTER] 1 user@ debian :~ $ python 2 Python ( default, Jun , 13: 08: 31) 3 [ GCC ] on linux2 4 Type " help ", " copyright ", " credits " or " license " for more information. 5 >>> 1 >>> >>> >>> 4* >>> 9/4 # >>> 9%4 # >>> 9.0/4 # # 13 >>> 2**10 # Python2 (/) 2^10 Python (XOR) **10 Python3 / Sage ^ 5/3 5 3 CRTL+d exit() 1 >>> exit () # ctrl +d 2 user@debian :~$ 2 1 >>> a = 6 # a 6 2 >>> a # a >>> a = 8 # a 8 5 >>> a 3
10 >>> a = a + 5 # a 5 8 >>> a >>> a += 1 # a 1 11 >>> a a=a+5 a a+5 = 1 >>> b 2 Traceback ( most recent call last ): # 3 File "<stdin >", line 1, in? # 4 NameError : name b is not defined # 5 >>> b = -4 6 >>> a+b 7 10 a z, A Z, 0 9, _ 3 Python Python print and for if elif else del is raise assert import from lambda return break global not try class except or while continue exec pass yield def finally in 4 Python 65, 3, 9.23 Hello >>> x = hello world 2 >>> x 3 hello world 4
11 4.2 4 x hello world >>> aa = Alice # a a A l i c e 2 >>> aa 3 Alice 4 >>> aa + Bob 5 AliceBob 6 >>> aa + and Bob 7 Alice and Bob " " 1 >>> a = " This is a pen " 2 >>> print a 3 This is a pen # \n 1 >>> a = aaa \ nbbb \ nccc 2 >>> a 3 aaa \ nbbb \ nccc 4 >>> print a 5 aaa 6 bbb 7 ccc \n """ """ 1 >>> a = aaa 2... bbb 3... ccc 4 >>> a 5 aaa \ nbbb \ nccc 6 >>> print a 7 aaa 8 bbb 9 ccc \,, \, ", \ \\ \ \" " \ \n \t 4.2 str (string) 5
12 >>> type ( hello ) # type ( hello ) 2 <type str > # s t r (int) (float) 1 >>> type (123) # <type int > # 3 >>> type (3.14) # <type float > # float 5 >>> a = 3.14 # a >>> type ( a) 7 <type float > # a (3.14) float 4.3 int (integer) float (floating point number) Python 1 >>> aa = 10 # int 2 >>> bb = 3.14 # float 3 >>> cc = aa + bb 4 >>> cc >>> type (cc) 7 <type float > int (PC ) long 1 >>> dd = 2**62 # d d >>> dd >>> type (dd) 5 <type int > # i n t 6 >>> ee = 2**65 # e e >>> ee L # L L o n g 9 >>> type (ee) 10 <type long > # long int long CPU Python3 int python2 long Python3 6
13 >>> Alice Traceback ( most recent call last ): # 3 File "<stdin >", line 1, in? # 4 TypeError : cannot concatenate str and int objects # str int str() str(123)= 123 int() int( 123 )=123) float() float( )= >>> Alice + str (1999) # Alice 2 Alice >>> aa = 123 # >>> int (aa) # >>> float (aa) # Python (operator) + (Addition) (Subtraction) * (Multiplication) 4*5 20 / (Division) 14/ / % (Modulus) 8%5 3 ** (Power) 2**3 2 3 = 8 5*4/3**2 7
14 6 (PRINT) 1 5*4/3**2 = 5*4/(3**2) # 2 = 5*4/9 3 = (5*4)/9 # 4 = 20/9 5 = 2 # 1 3**3**3 = L 2 (3**3)**3 = **(3**3) = L ** Python / 1 5.0*4/3**2 = 5.0*4/9 2 = 20.0/9 3 = (print) Python print print01.py 1 a = 6 2 print 6 3 b = 4 4 a + b print 1 print 4 2 print print, 1 print 4, 2 print print 8
15 7 7 1 >>> a = [ Alice, Bob, 2,3,8] # a 2 >>> a # a 3 [ Alice, Bob, 2,3,8] 4 >>> type (a) # a 5 <type list > # a 1 >>> a [0] # a 1 2 Alice 3 >>> a[ -1] # a >>> a [3] # a >>> a[ -2] # a >>> a [8] 2 Traceback ( most recent call last ): 3 File " <stdin >", line 1, in? 4 IndexError : list index out of range a[:n] n, a[-n:] n, a[n:] n, a[:-n] n, a[n:m] n m 1 >>> a = [ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p ] 2 >>> print a [:5] 3 [ a, b, c, d, e ] 4 >>> print a [ -5:] 5 [ l, m, n, o, p ] 1 >>> a = [1,2,3] 2 >>> b = [ a, b, c ] 3 >>> a + b 4 [1, 2, 3, a, b, c ] append() 9
16 8 PYTHON 1 >>> a. append ( Alice ) 2 >>> a 3 [1,2,3, Alice ] 1 >>> a = [1,2,3] 2 >>> a [0] = Alice #a [0] A l i c e 3 >>> a 4 [ Alice, 2, 3] pop(), remove() 1 >>> aa = [ a, b, c, d, e, b, 23, 8, 13] 2 >>> aa.pop () # a a >>> aa 5 [ a, b, c, d, e, b, 23, 8, 12] 6 >>> aa.pop (3) # a a 3 7 d 8 >>> aa 9 [ a, b, c, e, b, 23, 8] 10 >>> aa. remove ( b ) # a a b 11 >>> aa 12 [ a, c, e, b, 23, 8] # b 1 >>> range (5) 2 [0, 1, 2, 3, 4] 3 >>> range (3,6) 4 [3, 4, 5] 5 >>> range ( -3,3) 6 [-3, -2, -1, 0, 1, 2] 8 Python 8.1 (list) (tuple) 1 >>> a = (3,7, abc ) # ( tuple ) 2 >>> print a 3 (3, 7, abc ) 4 >>> type ( a) 5 <type tuple > # a Immutable( ) Immutable 10
17 8.2 (dictionary) 8 PYTHON 8.2 (dictionary) (key) (value) 1 >>> a = { birth :1534, type : A, name : Nobunaga, death :1582} 1 >>> print a[ birth ] keys() values() 1 >>> b = a. keys () # a b 2 >>> print b 3 [ death, type, name, birth ] 4 >>> c = a. values () # a c 5 >>> print c 6 [1582, A, Nobunaga, 1534] del 1 >>> del a[ type ] # t y p e 2 >>> print a 3 { death : 1582, name : Nobunaga, birth : 1534} 1 >>> a[ hobby ] = tea 2 >>> print a 3 { hobby : tea, death : 1582, name : Nobunaga, birth : 1534} immutable 1 >>> a = {(1,1,0): police, (1,1,9): fire, (1,7,7): weather } 2 print a 3 {(1, 1, 0): police, (1, 1, 9): fire, (1, 7, 7): weather } 1 >>> a = [(1, One ), (2, Two ), (3, Three )] 2 >>> b = dict ( a) 3 >>> print b 8.3 (set) set immutable set 1 >>> a = [1,4,3,2,2,2] 2 >>> b = set ( a) 3 >>> print b 4 set ([1, 2, 3, 4]) 5 >>> b. add (5) # b 5 11
18 9 6 >>> print (b) 7 set ([1, 2, 3, 4, 5]) e π 20 pp = ee = ee pp 20 (print) Python problem01.py python problem01.py e π 20 12
19 10 10 raw_input() input() *5 input1.py 1 # -*- coding : utf -8 -*- 2 3 namae = raw_input ( ) 4 print, namae, 1 user@ debian :~/ Desktop / dataproc1$ python input1. py 2 Enter namae 3. namae 4. raw_input() namae input() input2.py 1 # -*- coding : utf -8 -*- 2 3 num = input ( ) 4 print, num **2, 1 user@ debian :~/ Desktop / dataproc1$ python input2. py BMI bmi1.py 1 # -*- coding : utf -8 -*- 2 3 namae = raw_input ( ) 4 shintyo = input ( ) *5 Python3 raw input() input() 13
20 11 5 weight = input ( ) 6 bmi = 10000* weight /( shintyo **2) 7 print namae,, bmi, BMI 11 Python Python True False 1 >>> a = 3 # a 3 2 >>> a == 3 # a 3 3 True #a ==3 4 >>> a == 2 # a 2 5 False #a ==2 6 >>> a > 2 7 True 8 >>> 3!= 2 #3 2 9 True #3 2 ==, >,!= ==!= < > <= >= =,, <, >,, less than or equal!= not equal True False and, or, not 1 >>> a = True # a T r u e 2 >>> b = False # b F a l s e 3 >>> a and b # a b 4 False 5 >>> a or b # a b 6 True 7 >>> not a # a 8 False ==!= in ==!= in 14
21 12 1 >>> a = [3,6,5,1] # a [3,6,5,1] 2 >>> 5 in a #5 a 3 True 4 >>> 7 in a #7 a 5 False type 1 >>> a = [3,5,6,1] 2 >>> type ( a) 3 <type list > 4 >>> type ( a) == list 5 True 6 >>> type ( a) == tuple 7 False if (True False) if if A A X A Python 15
22 12.2 if-else 12 Python if 1 if A: 2 [ X ] 3 [ X ] 4 [ X ] A True X False X if X X X X if A: X if Python (1) a (2) a a is even a (3) a if1.py 1 # -*- coding : utf -8 -*- 2 a = input ( Input integer a: ) 3 4 if a%2 == 0: # a 5 print a is even 6 a = a/2 # a 7 8 print a # a 4 6 if 12.2 if-else X Y 16
23 12.2 if-else 12 if A: A A X A else: X Y Y if 1 if A: # A 2 X # X 3 if not A: # A 4 Y # Y if-else Python if-else 1 if A: 2 X 3 else : 4 Y A True X False Y X, Y if-else (1) a (2) a a (3) a a 3*a+1 (4) a if2.py 1 # -*- coding : utf -8 -*- 2 a = input ( a?: ) 3 4 if a%2 == 0: # a 5 a = a/2 # a 6 else : # 17
24 12.3 if-elif-else 12 7 a = 3*a + 1 # a 3 a print a # a 12.3 if-elif-else if-elif-else elif else if if-elif-else 1 if A: 2 X 3 elif B: 4 Y 5 else : 6 Z A X A B True Y A B Z C D elif if A: A A X A B B elif B: B Y X Y Z else: Z elif if-elif-elif-elif-else 12.4 if if-elif-else
25 Python uruuq.py 1 # -*- coding : utf -8 -*- 2 year = input ( : ) # y e a r 3 4 if year % 400 == 0: # y e a r print year, 6 elif year % 100 == 0: # y e a r print year, 8 elif year % 4 == 0: # y e a r 4 9 print year, 10 else : # 11 print year, BMI BMI (1) namae (2) shintyo, weight (3) bmi (4) bmi<18.5 (5) bmi<25.0 (6) bmi<30 (7) ***** bmi2.py 1 # -*- coding : utf -8 -*- 2 3 namae = raw_input ( ) 4 shintyo = input ( ) 5 weight = input ( ) 6 7 bmi = * weight /( shintyo **2) 19
26 13.1 BMI 13 8 bmi = round (bmi,1) # b m i print namae,, bmi,, if **********: 13 ***** 14 elif **********: 15 ***** 16 ***************: 17 ***** 18 ****: 19 ***** 20
27 14 FOR 14 For 14.1 For for hello 1 >>> print hello 2 hello 3 >>> print hello 4 hello 5 >>> print hello 6 hello 7 >>> print hello 8 hello 9 >>> print hello 10 hello for 1 for j in range (5): 2 print hello Python >>> for j in range(5):... print hello... hello hello hello hello hello range(5) [0,1,2,3,4] *6 1 >>> range (5) 2 [0,1,2,3,4] for for j in range(5): j 0 4 j 1 for j in range (5): 2 print j j 1 for x in range (5): 2 print x *6 Python3.x range list(range(5)) [0,1,2,3,4] 21
28 14.2 for 14 FOR for For 10 1 for j in range (10): < > 6 for for for j in range(10): X j for Start j=0 j=1 j=2 j=3 j=4 X X X X X End 3 for (5 ) 14.2 for for for1.py 1 for j in range (5): # 5 2 print wanwan, # 22
29 14.2 for 14 FOR 3 print nyannyan # wanwan nyannyan wanwan nyannyan wanwan nyannyan wanwan nyannyan wanwan nyannyan for for2.py 1 for j in range (5): # 5 2 print wanwan, # 3 print nyannyan # 4 5 print gaogao # wanwan nyannyan wanwan nyannyan wanwan nyannyan wanwan nyannyan wanwan nyannyan gaogao for for3.py 1 for j in range (10): # j print j, j **2 # j j 3 4 print owari # owari for4.py 1 # -*- coding : utf -8 -*- 2 for j in range (1,101): 3 print + str (j) for5.py 1 aa = [ Alice, falls, down, a, rabbit, hole. ] # a a 23
30 14.3 for 14 FOR 2 3 for i in aa: # a a i 4 print i, # i Alice falls down a rabbit hole for Python if-else for for6.py 1 for j in range (5): 2 print wanwan, 3 print nyannyan File "for6.py", line 3 print nyannyan ^ IndentationError: unindent does not match any outer indentation level for7.py 1 for j in range (5): 2 print wanwan, 3 print nyannyan File "for7.py", line 3 print nyannyan ^ IndentationError: unindent does not match any outer indentation level 14.4 for (for for ) for for for8.py 1 for i in range (5): # i = 0 ~ 5 2 for j in [ a, b, c ]: # j = a, b, c 3 print i, j, # i j 0 a 0 b 0 c 1 a 1 b 1 c 2 a 2 b 2 c 3 a 3 b 3 c 4 a 4 b 4 c for9.py 1 for i in range (1,10): # i =1,2,...,9 2 for j in range (1,10): # j =1,2,...,9 3 print i*j, # i* j 4 print # 24
31 14.5 for 2 if 14 FOR for 2 if if for j j is even j is odd for10.py 1 for j in range (1,10): 2 if j%2 == 0: 3 print j, is even 4 else : 5 print j, is odd 1 is odd 2 is even 3 is odd 4 is even 5 is odd 6 is even 7 is odd 8 is even 9 is odd 14.6 for 3: break for break for break for 2 2j j 1, 2, 3,, j for for11.py 1 for j in range (11): 2 a = 2**2** j 3 if a < : 4 print a 5 else : 6 print Too big!! 7 break # f o r Too big!! 25
32 15 15 Python 15.1 ( ) Python print 1 user@ debian :~/ Desktop / dataproc1 /06 $ 1 $ python. py >. txt 1 $ python for4. py > for4result. txt for4result.txt for4.py >> 1 $ python for3. py >> for4result. txt for4result.txt for3.py Python write1.py 1 # -*- coding : utf -8 -*- 2 abc = hogehoge # a b c 3 f = open ( test. txt, a ) # ( a) 4 f. write ( abc ) # abc text. t x t ( ) 5 f. close () # 1 $ python write1. py test.txt hogehoge 3 1 f = open ( test. txt, w ) # ( w) CountSheep.py 1 # -*- coding : utf -8 -*- 2 3 abc = # a b c 26
33 for i in range (10): 6 abc = abc + + str (i)+ \n # \ n 7 8 f = open ( hitsuji. txt, w ) # ( hitsuji. txt ) w r i t e 9 f. write ( abc ) 10 f. close () hitsuji.txt 15.3 read readlines 1 $ python for11. py > hoge. txt hoge.txt for11.py read read1.py 1 # -*- coding : utf -8 -*- 2 3 f = open ( hoge. txt, r ) # 4 aaa = f. read () # hoge. t x t a a a 5 print aaa # a a a 6 7 f. close () # hoge. t x t Too big!! readlines read2.py 1 # -*- coding : utf -8 -*- 2 3 f = open ( hoge. txt, r ) # 4 aaa = f. readlines () # hoge. t x t a a a 5 print aaa # a a a 6 7 f. close () # hoge. t x t [ \n, 4\n, 16\n, 256\n, 65536\n, \n, Too big!!\n,] aaa hoge.txt \n 27
34 n + 1 3n + 1 n n n n n 3n Collatz a 1. a 2. maxiter for maxiter 4. a 1 break for 5. a a 6. a a 3a a Python **** collatz.py 1 a = input ( a?: ) 2 print a, 3 4 maxiter = for i in range ( maxiter ): 6 *********** 7 break 8 ************** 9 ******* 10 ***** 11 *********** 12 print a, a 19 a?: while (1000 ) while 28
35 x x 8 1 import random # r a n d o m 2 x = random. randint (1,10) # x 3 print x (i) x (ii) x (iii) a (iv) a = x (v) a < x a > x (vi) (iii) (v) 8 Game Over (1) random (2) x (3) x x 8 (4) for j 0 7 (5) (8) (5) input 8 j x a (6) a = x break for (7) a < x (8) (9) x a (10),(11) (10) x (11) Game Over Python find number.py 29
36 17 WHILE 17 while 3n + 1 n n n n n 3n + 1 n n = 1 for 1000 n = 1 n = 1 for while 17.1 while for while while 1 while A: 2 [ X ] 3 [ X ] A True X A False X while A True X X A A True X False while A True A False while break, continue X break while X continue X A Start while A: A X True False 4 while X End 5 while 30
37 17.2 while 17 WHILE while while1.py 1 a = 1 2 while a <10: # a print a*a, # a 4 a = a+1 # a 5 6 print owari # w h i l e owari A a<10 X print a*a; a = a+1, while1.py 1. a 1 2. a<10 a=1 a<10 3. a*a=1 a 1 (a=2 ) 4. a<10 a<10 5. a*a=4 a 1 (a=3 ) a*a=9 a 1 (a=10 ) 8. a<10 a<10 while 9. owari while for for while1.py 1 for a in range (1,10): 2 print a* a 3 4 print owari 17.2 while n + 1 while n 3n + 1 while2.py 1 a = input ( Input an integer : ) # a 2 print a, # a 3 4 while a!= 1: # a 1 5 if a%2 == 0: # a 6 a = a/2 7 else : # a 8 a = 3*a+1 9 print a, 31
38 17.2 while 17 WHILE Input an integer: a= a = 1 Input an integer: while while3.py 1 # -*- coding : utf -8 -*- 2 j=1 3 while True : # 4 print + str (j)+ 5 j = j while True CTRL + C while break, else, continue while break while4.py 1 # -*- coding :utf -8 -*- 2 j=1 3 while True : 4 print + str (j)+ 5 j=j +1 6 if j > : # w h i l e 7 break 8 9 print " Too much sheeps! I m already asleep... zzz " Too much sheeps! I m already asleep...zzz. while else while False while else 32
39 17.2 while 17 WHILE while else.py 1 a=0 2 while a <5: 3 a = a+1 4 print a, 5 else : 6 print hogehoge 7 8 print END hogehoge END break while-else while continue ( ) Shinshu ns 1 >>> ns in Shinshu 2 True 3 >>> sn in Shinshu 4 False while continue.py 1 # -*- coding : utf -8 -*- 2 a=0 3 while a <20: 4 a=a +1 5 if 4 in str (a): # a 4 6 continue # p r i n t w h i l e 7 else : # 8 print + str (a)+ # 9 10 print zzz zzz... 33
40 17.2 while 17 WHILE for 1 # -*- coding : utf -8 -*- 2 for i in range (1,21): 3 if not 4 in str (i): # i 4 4 print + str (i)+ 5 6 print zzz , 1, 2, 3, 5, 8, 13, 21, 34, a 1 = 1, a 2 = 1, a n+1 = a n + a n 1, n = 2, 3, 4, (1) n a n while 1. maxvalue = a=1 b=1 3. while a<maxvalue a 5. a, b b, a+b 6. a<maxvalue while while5.py 1 maxvalue = # m a x v a l u e 2 a = 1 # a = 1 3 b = 1 # b = 1 4 while a < maxvalue : 5 print a # 6 a, b = b, a+b # 7 8 print The next value is, a # the next value i s a The next value is ( 2) n 2 n n n 1. n ( n 2 ) 2. i = 2 34
41 18 3. i 2 n n i n 3 5. i i n while primeq.py 1 # -*- coding :utf -8 -*- 2 n = input ( Input an integer ( >1): ) # n 3 i = 2 # i = 2 4 while i*i <= n: # i* i n 5 if n % i == 0: # n i 6 print n, is not a prime. # n 7 break # w h i l e else : 9 i += 1 # i 10 else : # i*i>n 11 print n, is prime. # n print Input an integer: n = while primeq.pyn = a, b b = 0 a b 0 a b b r r a b Python 1. a, b 2. b 0 3,4,5 while b = a b r 4. a b 5. b r 6. b = 0 a a 35
42 gcd.py 1 a = input ( Input an integer : ) 2 b = input ( Input an integer : ) 3 while *******: 4 ********** 5 ********** 6 ********** 7 8 print greatest common divisor is, a ***** 36
43 19 19 [3,6,3,9] 1 >>> a = [1,3,2,4] 2 >>> a 3 [1,3,2,4] append 1 >>> a. append (7) 2 >>> a 3 [1,3,2,4,7] for 1 aa = [] # a a 2 for i in range (10): # i aa. append (i*i) # i* i a 4 5 print aa # a a [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] i 2 (i = 0, 1, 2,, 9) 1, 9, 25, 49, 81, for 1 bb = [] # b b 2 for i in range (20): # i if i%2 == 1: # i 4 bb. append (i*i) # i* i a 5 6 print bb # b b [1, 9, 25, 49, 81, 121, 169, 225, 289, 361] Python 1 cc = [i*i for i in range (10)] # 2 print cc [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] bb 37
44 20 1 dd = [ i* i for i in range (20) if i %2==1] 2 print dd [1, 9, 25, 49, 81, 121, 169, 225, 289, 361] 1 lis = [ a, b, c ] 2 ee = [ (i, j) for i in range (1,5) for j in lis ] 3 print ee [(1, a ), (1, b ), (1, c ), (2, a ), (2, b ), (2, c ), (3, a ), (3, b ), (3, c ), (4, a ), (4, b ), (4, c )] 20 for while INPUT x FUNCTION f: OUTPUT f(x) 1 def ( ) : 2 [ X ] # 3 return [ ] # def def : func1.py 38
45 def greeting (): # 2 print "I m fine." # 3 4 print How are you? # How are you? 5 greeting () # How are you? I m fine. greeting() print "I m fine" return func2.py 1 def sanjou (a): # s a n j o u a 2 return a*a*a # a 3 4 print sanjou (2) # 8 5 print sanjou (3) # b = sanjou (1)+ sanjou (2)+ sanjou (3)+ sanjou (4) 7 print b sanjou( ) a odd even func3.py 1 def guuki (a): 2 if a%2 == 0: # a 3 return even # e v e n 4 else : # 5 return odd # o d d 6 7 print guuki (1232), guuki (99) even odd n True False uruuq func4.py 1 def uruuq (n): 2 if n %400 == 0: 3 return True 4 elif n %100 == 0: 5 return False 6 elif n%4 == 0: 7 return True 8 else : 9 return False 39
46 for i in range (1000,2018): 12 if uruuq (i): # i 13 print i, # i func5.py 1 # -*- coding : utf -8 -*- 2 def CountSheeps ( a): 3 for i in range (1,a +1): # i 1 a 4 print + str (i) + # i 5 6 CountSheeps (45) # def nobu (): 2 print De aruka 3 4 oda = nobu # n o b u o d a 5 oda () # o d a De aruka a, b ***** def gcd.py 1 def gcd (a,b): 2 ************* 3 ******* 4 ***** 5 ***** 6 ******** 7 8 print gcd ( , )
47 n n True False primeq(n) primelist.py 41
48 20.3 lambda lambda lambda Python lambda lambda 1 lambda x, y : ( x y ) n n 2 f lambda 1 >>> f = lambda a : a*a # f a a * a 2 >>> f (3) 3 9 lambda 1 a = [ lambda x, y : x+y, lambda x,y: x-y, lambda x,y: x*y] 2 3 for f in a: 4 print f (3,5) N N = 100 S = k 2 N N N S = = k 2 = j 2 = l 2 (2) k=1 k=1 j=1 l=1 Σ k, j, l *7 (2) k, j, l Σ S N S N k c s daikei.py 1 def daikei (a,b,h): # a b h *7 42
49 c = a+b # c 3 s = 1.0* c*h / 2 # s 4 return s 5 6 S = daikei (3,5,8) # S 7 print S 8 9 print c # c 32.0 Traceback (most recent call last): File "daikei.py", line 8, in? print c NameError: name c is not defined Python def """ """ gcd(a,b) 1 # -*- coding : utf -8 -*- 2 3 def gcd (a,b): 4 """ a b 5 6 """ 7 while b!= 0: 8 a, b = b, a%b 9 return a print gcd (1428,2618) 238 4,5, def (while primeq.py) n True False primeq.py 1 # -*- coding :utf -8 -*- 43
50 def primeq (n): 3 """ n T r u e F a l s e """ 4 if n < 2: 5 return False 6 else : 7 i=2 8 while i **2 <= n: 9 if n%i == 0: # n i 10 return False 11 i=i return True # print [ k for k in range (1,101) if primeq ( k)] [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] AKS Miller-Rabin Sage is_prime 20.7 n! = (n 1) n for kaijou1.py 1 def kaijou (n): 2 """ n n! f o r """ 3 a=1 4 for i in range (1,n +1): 5 a = a* i 6 return a 7 8 for i in range (1,10): #i =1,...,9 9 print kaijou (i), # kaijou (i) f(n) f(0) = 1, f(1) = 1, f(n) = n f(n 1) n f(n) = n! (recursive definition) Python 44
51 n! kaijou2.py 1 def kaijou (n): 2 """ n! """ 3 if n ==0 or n ==1: 4 return 1 5 else : 6 return n* kaijou (n -1) # kaijou (n -1) 7 8 for i in range (10): #i=0,1,2,,9 9 print kaijou (i), # kaijou (i) gcd(a,b) gcd rec.py 1 def gcd (a,b): 2 if b == 0: # b=0 3 return a # a 4 else : # 5 return gcd (b,a%b) # gcd (b,a%b) 6 7 print gcd (1428,2618) a=1428, b=2618 gcd(a,b) 2. b = 0 gcd(2618,1428%2618) gcd(2618,1428) gcd(1428,2618%1428) %1428=1190 gcd(1428,1190) gcd(1190,238) 238=1428% gcd(238,1190%238) %238= print
52 mc n m n mc n = m! (m n)!n! 0 if m < n or n < 0 mc n = 1 if m = 0 or m = n m 1C n + m 1 C n 1 (3) (4) n < 0 m < n m C n 0 (3), (4) m C n C(m,n), D(m,n) combinat1.py 1 def kaijou (n): # kaijou (n)=n! 2 if n == 0 or n ==1: 3 return 1 4 else : 5 return n* kaijou (n -1) 6 7 def C(m,n): # (1) 8 return kaijou (m )/( kaijou (m-n)* kaijou (n)) 9 10 def D(m,n): # (2) 11 if n <0 or m<n: 12 return 0 13 elif m == 0 or m == n: 14 return 1 15 else : 16 return D(m -1,n) + D(m -1,n -1) for i in range (7): #i=0,1,2,3,4,5,6 19 print C(6,i), #C(6,i) print # for i in range (7): #i=0,1,2,3,4,5,6 24 print D(6,i), #C(6,i) combinat2.py 1 # -*- coding :utf -8 -*- 2 from time import time # t i m e t i m e 3 4 def kaijou (n): 5 if n == 0 or n ==1: 6 return 1 7 else : 46
53 return n* kaijou (n -1) 9 10 def C(m,n): # (1) 11 return kaijou (m )/( kaijou (m-n)* kaijou (n)) def D(m,n): # (2) 14 if n <0 or m<n: 15 return 0 16 elif m == 0 or m == n: 17 return 1 18 else : 19 return D(m -1,n) + D(m -1,n -1) time1 = time () # t i m e 1 22 print C (23,12) # C (23,12) 23 time2 = time () # t i m e 2 24 print, time2 - time1, 25 print D (23,12) # D (23,12) 26 time3 = time () # t i m e 3 27 print, time3 - time2, (3) (4) 1.78 (4) (4) C(5,2) C(5, 2) = C(4, 2) + C(4, 1) = C(3, 2) + C(3, 1) + C(3, 1) + C(3, 0) = C(2, 2) + C(2, 1) + C(2, 1) + C(2, 0) + C(2, 1) + C(2, 0) + C(2, 0) + C(2, 1) = 1 + C(1, 1) + C(1, 0) + C(1, 1) + C(1, 0) + C(1, 0) + C(1, 1) + C(1, 1) + C(1, 0) + C(1, 0) + C(1, 1) + C(1, 0) + C(1, 1) + 0 = C(0, 0) + C(0, 1) C(0, 0) + C(0, 1) + C(0, 0) + C(0, 1) C(0, 0) + C(0, 1) + C(0, 0) + C(0, 1) C(0, 0) + C(0, 1) + 0 = = 10 C(54,24)= m C n = m!/(m n)!n! 20.9 n n j=1 1 j 2 (5) Basel sum(n) Basel sum.py 1 def Basel_sum (n): 47
54 if n <2: 3 return 1 4 else : 5 ****** ************************ 6 7 print Basel_ sum (10) 8 print Basel_ sum (100) 48
55 21 21 Sage Python (expression) (statement) ans = 2^2^2 ans ans a=1 a= eval exec eval exec eval (expression) exec (statement) 1 >>> eval ( 1+3 ) # >>> exec ( a=3 ) #a=3 4 >>> print a a=3 1+3 a=3 eval 1 def func1 (): 2 return 2**2**2 3 4 def func2 (): 5 return hogehoge 6 7 def func3 (): 8 return type (1.4) 9 10 def func4 (): 11 return [1,2,3,4] print func1 () 14 print func2 () 15 print func3 () 16 print func4 () 16 hogehoge <type float > [1,2,3,4] func1, func2, func3, func4 4 4 eval 1 def func1 (): 2 return 2**2**2 49
56 22 SET 3 4 def func2 (): 5 return hogehoge 6 7 def func3 (): 8 return type (1.4) 9 10 def func4 (): 11 return [1,2,3,4] for i in range (1,5): 14 print eval ( func + str (i)+ () ) str 22 Set 22.1 Python (set) set([1,3,4]) union intersection, & Python 1 >>> a = set ([1,3,4]) # a 2 >>> b = set ([3,7]) # b 3 >>> c = a b # c a b 4 >>> c 5 set ([1, 3, 4, 7]) 6 >>> d = a & b # d a b 7 >>> d 8 set ([3]) union() intersection() = 1 >>> a. union (b) #a. union (b) 2 set ([1, 3, 4, 7]) # a b 3 >>> a. intersection (b) #a. intersection (b) 4 set ([3]) # a b 5 >>> a 6 set ([1, 3, 4]) # a 7 >>> b 8 set ([3, 7]) # b 9 >>> a = b # a b 10 >>> a # a 11 set ([1, 3, 4, 7]) # b add remove 50
57 22.2 Set SET 1 >>> a. add (8) # a 8 2 >>> a # a 3 set ([8, 1, 3, 4]) # a 8 4 >>> a. remove (1) # a 1 5 >>> a 6 set ([8, 3, 4]) # a Set (2 + 9) (3/3) = Python Python set a, b a + b, a b, b a, a b, a/b, b/a nikou(a,b) set 0 nikou.py 1 def nikou (a,b): 2 if a!=0 and b!=0: # a b 0 3 return set ([a+b,a-b,b-a,a*b,1.0* a/b, 1.0* b/a]) # 4 elif b == 0: # b=0 5 return set ([a, -a, 0]) 6 else : # a=0 7 return set ([b, -b, 0]) 8 9 print nikou (3,4) #3,4 set([0.75, 1, 7, 12, , -1]) 1.0* / a,b,c sankou(a,b,c) 3 3,, (a b) c : a, b c (a c) d : a, c d 51
58 22.2 Set SET (b c) a : b, c a 3 3 a,b,c 2 sankou(a,b,c) sankou1.py 1 def nikou (a,b): 2 if a!=0 and b!=0: 3 return set ([a+b,a-b,b-a,a*b, 1.0* a/b,1.0* b/a]) 4 elif b == 0: 5 return set ([a,-a,0]) 6 else : 7 return set ([b, -b, 0]) 8 9 def sankou (a,b,c): # a,b, c 10 ResultSet = set ([]) # R e s u l t S e t 11 for i in nikou (a,b): # a, b i 12 ResultSet = nikou (i,c) # i, c R e s u l t S e t 13 for i in nikou (b,c): 14 ResultSet = nikou (i, a) 15 for i in nikou (a,c): 16 ResultSet = nikou (i, b) 17 return ResultSet # R e s u l t S e t print sankou (4,4,9) # 4,4,9 20 print # 21 print 10 in sankou (4,4,9) # sankou (4,4,9) 1 0 set([ , , , 1, , 9, , , 144, 17, 20, 25, , , 0, 32, , 40, 7, , 52, , , , 72, , -7, -32, , , -20, , -9, , , -1, ]) True a b c 9 10 sankou2.py 1 # -*- coding :utf -8 -*- 2 def nikou (a,b): 3 if a!=0 and b!=0: 4 return set ([a+b,a-b,b-a,a*b, 1.0* a/b,1.0* b/a]) 5 elif b == 0: 6 return set ([a,-a,0]) 7 else : 8 return set ([b, -b, 0]) 9 10 def sankou (a,b,c): # a,b, c 11 ResultSet = set ([]) # R e s u l t S e t 12 for i in nikou (a,b): # a, b i 13 ResultSet = nikou (i,c) # i, c R e s u l t S e t 52
59 22.2 Set SET 14 for i in nikou (b,c): 15 ResultSet = nikou (i, a) 16 for i in nikou (a,c): 17 ResultSet = nikou (i, b) 18 return ResultSet # R e s u l t S e t number = 0 # n u m b e r for i in range (10): 23 for j in range (i,10): 24 for k in range (j,10): 25 if 10 in sankou (i,j,k): # 1 0 sankou (i,j,k) 26 print i,j,k #i,j, k 27 number = number +1 # n u m b e r print 10, number, a,b,c,d 2 (A) 3 (B) 2 (a+d*c)*b (a*d)+(b/c) (A) (B) (A) yonkoua(a,b,c,d) 1 def yonkoua (a,b,c,d): 2 ResultSet = set ([]) 3 for i in sankou (a,b,c): # a,b, c i 4 ResultSet = nikou (i,d) # i d R e s u l t S e t 5 for i in sankou (a,b,d): 6 ResultSet = nikou (i, c) 7 for i in sankou (a,c,d): 8 ResultSet = nikou (i, b) 9 for i in sankou (b,c,d): 10 ResultSet = nikou (i, a) 11 return ResultSet (A) 10 4 yonkou1.py 1 # -*- coding :utf -8 -*- 53
60 22.2 Set SET 2 def nikou (a,b): 3 if a!=0 and b!=0: 4 return set ([a+b,a-b,b-a,a*b, 1.0* a/b,1.0* b/a]) 5 elif b == 0: 6 return set ([a,-a,0]) 7 else : 8 return set ([b, -b, 0]) 9 10 def sankou (a,b,c): # a,b, c 11 ResultSet = set ([]) # R e s u l t S e t 12 for i in nikou (a,b): # a, b i 13 ResultSet = nikou (i,c) # i, c R e s u l t S e t 14 for i in nikou (b,c): 15 ResultSet = nikou (i, a) 16 for i in nikou (a,c): 17 ResultSet = nikou (i, b) 18 return ResultSet # R e s u l t S e t def yonkoua (a,b,c,d): 21 ResultSet = set ([]) 22 for i in sankou (a,b,c): # a,b, c i 23 ResultSet = nikou (i,d) # i d R e s u l t S e t 24 for i in sankou (a,b,d): 25 ResultSet = nikou (i, c) 26 for i in sankou (a,c,d): 27 ResultSet = nikou (i, b) 28 for i in sankou (b,c,d): 29 ResultSet = nikou (i, a) 30 return ResultSet number = for i in range (10): 35 for j in range (i,10): 36 for k in range (j,10): 37 for l in range (k,10): 38 if 10 in yonkoua (i,j,k,l): 39 print i,j,k,l 40 number = number print 10, number, (A) 10 4 B) (1+1)*(1+4)=
61 22.2 Set SET (B) yonkoub(a,b,c,d) 4 yonkoub(a,b,c,d) 1 def yonkoub (a,b,c,d): 2 ResultSet = set ([]) # R e s u l t S e t 3 for i in nikou (a,b): # a b i 4 for j in nikou (c,d): # c d j 5 ResultSet = nikou (i,j) # i j R e s u l t S e t 6 for i in nikou (a,c): 7 for j in nikou (b,d): 8 ResultSet = nikou (i, j) 9 for i in nikou (a,d): 10 for j in nikou (b,c): 11 ResultSet = nikou (i, j) 12 return ResultSet # R e s u l t S e t a, b, c, d a b c d 10 make10.py 1 # -*- coding :utf -8 -*- 2 def nikou (a,b): 3 if a!=0 and b!=0: 4 return set ([a+b,a-b,b-a,a*b, 1.0* a/b,1.0* b/a]) 5 elif b == 0: 6 return set ([a,-a,0]) 7 else : 8 return set ([b, -b, 0]) 9 10 def sankou (a,b,c): # a,b, c 11 ResultSet = set ([]) # R e s u l t S e t 12 for i in nikou (a,b): # a, b i 13 ResultSet = nikou (i,c) # i, c R e s u l t S e t 14 for i in nikou (b,c): 15 ResultSet = nikou (i, a) 16 for i in nikou (a,c): 17 ResultSet = nikou (i, b) 18 return ResultSet # R e s u l t S e t def yonkoua (a,b,c,d): 21 ResultSet = set ([]) 22 for i in sankou (a,b,c): # a,b, c i 23 ResultSet = nikou (i,d) # i d R e s u l t S e t 24 for i in sankou (a,b,d): 25 ResultSet = nikou (i, c) 26 for i in sankou (a,c,d): 27 ResultSet = nikou (i, b) 28 for i in sankou (b,c,d): 29 ResultSet = nikou (i, a) 30 return ResultSet 31 55
62 SET 32 def yonkoub (a,b,c,d): 33 ResultSet = set ([]) # R e s u l t S e t 34 for i in nikou (a,b): # a b i 35 for j in nikou (c,d): # c d j 36 ResultSet = nikou (i,j) # i j R e s u l t S e t 37 for i in nikou (a,c): 38 for j in nikou (b,d): 39 ResultSet = nikou (i, j) 40 for i in nikou (a,d): 41 for j in nikou (b,c): 42 ResultSet = nikou (i, j) 43 return ResultSet # R e s u l t S e t def yonkou (a,b,c,d): 46 ResultSet = set ([]) 47 ResultSet = yonkoua (a,b,c, d) 48 ResultSet = yonkoub (a,b,c, d) 49 return ResultSet counter = for i in range (10): 54 for j in range (i,10): 55 for k in range (j,10): 56 for l in range (k,10): 57 if 10 in yonkou (i,j,k,l): 58 print i,j,k,l 59 counter = counter print 10 4, counter, >>> == 1 2 True 3 >>> == 1 4 False a, b, c, d, e(0 a b c d e 9) make100.py 56
63 24 SAGE II SageMath 23 SageMath SageMath( Sage ) Sage Python Sage Python Sage Sage Sage Linux, Mac, Windows 24 Sage Sage 4 1. ( sage CUI) 2. Sage ( sage.sage ) 3. Sage ( notebook() ) 4. Sage (sage:load(.sage )) 24.1 Sage Sage PC sage Sage 1 user@debian :~$ sage # S a g e M a t h $ 1 2 SageMath version 8.2, Release Date : Type " notebook ()" for the browser - based notebook interface. 4 Type " help ()" for help. 5 6 sage : Sage Python Sage 1+2 factor(2010) 1 sage : sage : factor ( 2010) 4 2 * 3 * 5 * 67 57
64 24.2 Sage 25 SAGE WEB factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s) Sage Python Sage 1. Sage.sage 2. sage.sage * 8 testfactor.sage 1 a = factor (2014) # 2014 a 2 print a # a 1 $ sage testfactor. sage 2 2 * 19 * 53 3 $ Python print Python 1 $ sage testfactor. sage > testfactor. txt 2 $ testfactor.txt 25 Sage Web Sage Try Sage Online : Sage Documentation : Sage Python *8 58
65 26 SAGE Download : Sage ( OS ) Sage Feature Tour : 26 Sage 26.1 SageMathCloud Sage Online Sage Web Try Sage Online Sage 26.2 Windows Sage SageMath8.0 Windows 1. SageMath SageMath-**.exe (xx Mac *9 PC Max OS X 1. Sage Web download sage dmg mac CPU intel intel OS bit sage-xx-x86_64-darwin-osx-10.10_x86_64-app.dmg -app Mac -app Unix command-line -app 2. dmg 3. sage 4. finder sage sage 5. Select to run it with Terminal : Choose Applications, then select All Applications in the Enable: drop down. Change the Applications drop down to Utilities. On the left, scroll and select Terminal. Click Open, then in the next dialog select Update. 6. Sage Window 7. Sage notebook() firefox safari URL *9 Mac 59
66 28 SAGE 27 Sage Sage Sage notebook() Sage 1 sage : notebook () firefox Sage * 10 worksheet New Worksheet Sage ( ) shift+enter evaluate Sage notebook() ctrl+c Sage exit Sage 28 Sage 28.1 Sage Python / a, b Python2 a/b Sage a/b a/b Python a b a**b Sage a^b a + b a+b a b a-b a b a*b a b a/b ab a^b *10 username = admin, password = sagesage 60
67 SAGE 28.2 Sage π pi e e i i 1 pi pi n() 1 n(pi) n( pi, digits =30) n(e) (square root) 1 sqrt (3) sqrt(3) 1 sqrt (3)* sqrt (3) 3 e pi 3 n(sqrt(3)) 28.3 Sage n Sage n n(a) a n 28.4 Sage i I 5 + 3i 5+3*I 61
68 SAGE 1 sage : (5+3* I )^2 2 30* I sage : a = 5+3* I; a. conjugate () # 4-3* I sage : exp (pi*i) 6-1 # E u l e r 28.5 Sage e π Sage (golden ratio) ϕ golden ratio ( 2 n ) 1 (Euler s constant) γ euler_gamma lim n k ln(n) k=1 ( 1) n (Catalan s constant) K catalan (2n + 1) 2. (twin prime) C 2 twinprime 28.6 k=1 p 3; p(p 2) (p 1) 2 Sage Sage Sage ZZ Integer Ring QQ Rational Field QQbar Algebraic Field Q SR Symbolic Ring (53bit) RR Real Field with 53 bits of precision 53 (53bit) RDF Real Double Field (53bit) CC Complex Field with 53 bits of precision 53 (400bit) RealField(400) 400 Z/pZ Q[ 5] 1 sage : ZZ 2 Integer Ring # QQ,RR, S R 3 sage : 5 in ZZ # 5 4 True 5 sage : 1.5 in ZZ 6 False 7 sage : 1.5 in QQ # True 9 sage : sqrt (2) in QQ # 2 10 False 62
69 31 11 sage : sqrt (2) in QQbar # 2 12 True 13 sage : x = var ( x ) # x 14 sage : x in SR # 15 True 1 print pi 2 print RDF (pi) 3 print RR(pi) 4 print RealField (200)( pi) pi sage : a = RR(pi ); exp (a*i) e -16* I e iπ = e-16*I i (plot) 29 Sage notebook a=3 a 3 a=5 a 5 Sage Action... Restart worksheet 30 Sage Tab Sage Sage dif Tab diff differences 2 diffe Tab differences diff differences 31 Typeset Typeset 1 integral ( sin (x)*e^x,x) Typeset 63
70 32 SAGE 8 Typeset 32 Sage Sage Sage worksheet sws Web * 11 * 12 Sage worksheet * Sage [File...] [Save worksheet to a file...] 2. OK 3. Web OK 4. sage01.sws dataproc1 sws worksheet 1. Sage notebook upload 2. Browse your computer to select a file to upload: *11 firefox *12 ( ) *13 64
71 34 SAGE 3. [upload] 33 Sage? 1 sum? sum sum 1 sum?? 34 Sage 34.1 Sage Word Sage New Worksheet Worksheet Edit Edit 1 2 {{{ id =1 3 4 /// 5 }}} Worksheet Worksheet 1 integrate ( sin (x),x) Edit 1 # 2 {{{ id =1 # 3 integrate ( sin (x),x) # 65
72 SAGE 4 /// # 5 -cos (x) # 6 }}} # 7 # 8 {{{ id =2 # 2 9 # 10 /// # 11 }}} # 2 {{{id=1 1 1 $\ sin (x)$ Save changes L A TEX L A TEX $ $ \[ \] \begin{equation}...\end{equation} html html 1 <h1 >1. </ h1 > 66
73 34.2 Sage 34 SAGE 2 <h2 >1.1 </h2 > 3 $\ int \ sin (x) dx$ 4 5 {{{ id =1 6 integrate ( sin (x),x) 7 /// 8 -cos (x) 9 }}} <h2 > 1.2 </h2 > 12 $\ int_0 ^\ pi \ sin (x) dx $ {{{ id =2 15 integrate ( sin (x),x,0, pi) 16 /// }}} \ begin { equation } 21 \ int_0 ^\ infty \ frac {1}{1+ x ^4} dx = \ frac {\ pi }{2\ sqrt {2}} 22 \ end { equation } {{{ id =3 25 integrate (1/(1+ x^4),x,0, oo) 26 /// 27 1/4* pi* sqrt (2) 28 }}} {{{ id = /// 33 }}} <h1> 1</h1> 1 2 <h2>... </h2> Worksheet html html 34.2 Sage 67
74 35 Sage Shift + L A TEX Save Changes Sage Worksheet 35 Sage Sage sagews01.sws Sage Upload 68
75 36 36 Python Python Python 1 def fib (n): # f i b n 2 a, b = 0, 1 # 3 for i in range (n): # 4 a, b = b, a+b # 5 return a # a 6 7 for i in range (1,10): #i=1,,9 8 print fib (i) # fib (i) 9 10 print type ( fib ) # f i b <type function > fib n 2 4 a (return) Python 4x + 3, x 2, sin(x), 1 x (6) x (variable) (indeterminate) x Python x x Sage 1 var ( x ) # x 2 f = x^2 # x^2 f 1 x x 2 f = x 2 1 print f # f 2 print f(x =5) # x=5 f 3 print type (f) # f 4 print type ( x) 69
76 36.1 Sage 37 x^2 25 <type sage.symbolic.expression.expression > <type sage.symbolic.expression.expression > f x 2 3,4 f x sage.symbolic.expression.expression fib function 2 1 var ( x ) 2 f(x) = x^2 # ( x) 3 4 print f 5 print f (5) # 6 print type ( f) x --> x^2 25 <type sage.symbolic.expression.expression > 2 x,y 1 var ( x y ) #x, y 2 g = (x+y )^2 # g 3 print g 4 print g(x=3, y =6) #x=3, y=6 g 5 print g(y =3) #y=3 g (x + y)^2 81 (x + 3)^ Sage Sage Sage sin, cos, tan, csc, sec, cot,arcsin, arccos log, ln, exp sinh, cosh, tanh arcsinh gamma(z) zeta 37 Sage Sage 37.1 plot f(x) plot 70
77 37.1 plot 37 plot f(x) 1 plot (f(x), (x,a,b)) f(x) x [a, b] sin(x) [ 6, 6] 1 plot ( sin (x), (x, -6,6)) sin(x) 1/x 2 1 plot (1/x, (x, -2,2)) /x 1/x 71
78 37.1 plot 37 f(x) [c, d] 1 plot (f(x), (x,a,b), ymin =c, ymax =d) f(x) x [a, b] y ymin=c, ymax=d 1/x [ 3, 4] 1 plot (1/x, (x, -2,2), ymin =-3, ymax =4) /x [ 3, 4] f(x), g(x), h(x) 1 plot ( (f(x),g(x),h(x)), (x,a,b) ) 3 sin(x), cos(x), tan(x) [ 7, 7] [ 5, 5] 1 plot ( ( sin (x), cos (x), tan (x)), (x, -7,7), ymin =-5, ymax =5) sin(x), cos(x), tan(x) 72
79 plot plot 1 plot ( f(x), (x,a,b), color =, 2 axes_labels =[, ], legend_label = ) red, yellow, blue, green RGB #3F4A46 axes_labels axes=false $ $ L A TEX \sin(x) sin(x) \\tan(x) tan(x) \\frac{a}{b} a b 1 plot ( sin (x ^2),(x,0,5), color = red, axes_labels =[ time, amplitude ], 2 legend_label = $\ sin (x ^2) $ ) amplitude 1 sin(x 2 ) time sin(x 2 ) 37.2 red, blue colors 1 for i in sorted ( colors ): 2 print i aliceblue antiquewhite aqua yellow yellowgreen 73
80 show() show() show 1 p1 = plot ( sin (x), (x, -6,6) ) 2 show (p1) 1 sin(x) p1 2 p1 2 p1.show() show() show 1 p1 = plot ( tan (x), (x, -6,6) ) 2 p1. show ( ymin =-5, ymax =5) 1 p1 = plot ( sin (x), (x, -5,5), legend_label = sin, color =" red ") 2 p2 = plot ( cos (x), (x, -5,5), legend_label = cos, color =" blue ") 3 p3 = plot ( tan (x), (x, -5,5), legend_label = $\\ tan (x)$, color =" green ") 4 p4 = p1+p2+p3 # p 4 p 1,p2, p 3 5 p4. show ( ymin =-3, ymax =3) # p 4 s h o w sin, cos, tan p1,p2,p3 4 p4 show p sin cos(x) tan(x) sin(x), cos(x), tan(x) graphics_array 74
81 graphics array 1 p1 = plot ( sin (x), (x, -4,4) ) 2 p2 = plot ( cos (x), (x, -4,4) ) 3 p3 = graphics_array ([p1,p2 ]) 4 p3. show ( aspect_ratio =1) aspect ratio aspect ratio sin(x), cos(x) fill 1 p1 = plot ( sin (x), (x, -5,5), fill = axis ) # 2 p2 = plot ( sin (x), (x, -5,5), fill = min ) # 3 p3 = plot ( sin (x), (x, -5,5), fill = max ) # 4 p4 = plot ( sin (x), (x, -5,5), fill = 0.5) # graphics_array ([[ p1, p2], [p3, p4 ]]). show () graphics_array([[a,b],[c,d]]) a c b d fill 75
82 sin(x) x plot ( sin (x), (x, -2,2), fill = x ^2-1) sin(x) x 2 1 (thickness) (dashed) plot plot 1 plot? 37.4 f(x, y) = 0 x, y implicit_plot implicit plot f(x, y) = 0 1 var ("x y") 2 implicit_plot (f(x,y), (x,a,b), (y,c,d)) 2 f(x, y) (x, y) [a, b] [c, d] x,y = var( x y ) x, y (x 3 + y 3 3xy) x 3 + y 3 3xy = var ("x y") 2 implicit_plot (x ^3+ y ^3-3* x*y, (x, -2,2), (y, -2,2)) 76
83 (x(t), y(t)) parametric_plot (x(t), y(t)) 11 1 t = var ( t ) 2 parametric_plot ([ cos (t) + 2* cos (t/4), sin (t) -2* sin (t /4)], 3 (t,0, 8* pi), fill = true ) x(t) = cos(t) + 2 cos(t/4), y(t) = sin(t) 2 sin(t/4) t 8π fill parametric plot(with filling) 37.5 list_plot 1 a = 2 list_plot (a) [3,2,6,3,12,-2,2] 2 [(1,2),(4,1),(3,4),(4,2)]
84 a = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10] 2 list_plot (a) plotjoined=true 13 1 a = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10] 2 list_plot (a, plotjoined = True ) (plotjoined=true) a = [( sqrt (i)* cos (i), sqrt (i)* sin (i)) for i in range (20)]; 2 list_plot (a, plotjoined = True ) { i(cos(i), sin(i)) i = 0, 1,, 19} 78
85 37.6 (x, y) (x, y) 2 f(x, y) f(x, y) > 0 regin_plot region plot f(x, y) > 0 (x, y) 1 x,y = var ( x,y ) 2 region_plot (f(x,y)>0, (x,a,b), (y,c,d)) sin(x 2 y 3 ) > 0 x, y 14 1 x,y = var ( x,y ) 2 region_plot ( sin (x^2 -y^3) >0, (x,-3, 3), (y,-3, 3)) sin(x 2 y 3 ) > 0 (x, y) [f(x,y)>0,g(x,y)>0,h(x,y)>0] 15 1 x,y = var ( x,y ) 2 region_plot ([x >0, y >0, x ^2+ y ^2 >0.5], (x, -1,1), (y, -1,1) ) x > 0, y > 0, x 2 + y 2 > 0.5 x, y region plot 100 plot_points=300 region_plot 79
86 37.7 ( ) region_ plot? 37.7 ( ) Sage 2 plot circle((a,b),r) (a, b), r ellipse((a,b),c,d) (a, b) c, d arrow((a,b),(c,d)) (a, b), (c, d) arc((a,b),r,sector=(c,d)) (a, b), r, (c, d) (c, d) 0 90 (0, π/2) line([(a,b),(c,d)]) (a, b) (c, d) linestype= -- marker= o point(a,b,size=r) (a, b) r text(, (a,b), fontsize=r) (a, b) r 16 1 s1 = plot (x^2,(x, -1,1)) 2 s2 = point ((0,0), size =100, color = black ) 3 s3 = arrow (( -1/2,1/4),(1,1), color = red ) 4 s4 = arc ((0,0),0.5, sector =(0, pi), color = green ) 5 s5 = s1 + s2 + s3 + s4 6 s5. show () f(x, y) f(x, y) 3 plot3d 80
87 38.2 density plot contour plot 38 2 plot3d f(x, y) 3 1 var ( x y ) 2 plot3d (f(x,y), (x,a,b),(y,c,d)) plot_points : () opacity : ( ) aspect_ratio : [1,2,1] 17 1 var ( x y ) 2 plot3d ( sin (x-y)*y* cos (x), (x, -3,3), (y, -3,3), 3 opacity =0.5, aspect_ ratio =[1,1,1]) 26 y sin(x y) cos(x) 38.2 density plot contour plot plot3d density plot contour plot 18 1 x, y = var ( x y ) 2 density_plot ( sin (x*y), (x, -3,3), (y, -3,3)) 81
88 sin(xy) 19 1 x, y = var ( x y ) 2 contour_plot ( cos (x)+ cos (y), (x, -8, 8), (y, -8, 8), contours =20) cos(x) + cos(y) implicit_plot3d parametric_plot3d plot_vector_field3d 38.4 Sage notebook png png pdf,eps,ps 82
89 39 notebook 1 p1 = plot ( sin (x), (x, -4,4)) 2 p1. save (". pdf ") eps pdf eps 3 eps, pdf, ps png Sage (**.sage ) plot.sage 1 p1 = plot ( sin (x), (x, -4,4)) 2 p1. save (" plot. pdf ") # p 1 p d f Emacs 1 user@debian :~$ sage plot. sage # p d f ( 2 user@debian :~$ 39 e z n z nz n k=0 z k k! n (nz) n k=0 k! (7) n ze z 1 = 1 roots x 5 + 3x + 1 == 0 1 eq = x ^5+3* x +1==0 2 eq. roots (x, ring =CC, multiplicities = False ) [ , *I, *I, *I, *I] multiplicities False 7 83
90 var ( z k ) #z, k 2 nn = 30 # n n f = sum (( nn*z)^k/ factorial (k), k,0, nn) # f 4 eq = f ==0 # f ==0 e q 5 lis = eq. roots (z, ring =CC, multiplicities = False ); # e q l i s 6 list_plot ( lis ) # l i s 29 n = 30 1 var ( z k ) #z, k 2 nn = 200 # n n f = sum (( nn*z)^k/ factorial (k), k,0, nn) # f 4 eq = f ==0 # f ==0 e q 5 lis = eq. roots (z, ring =CC, multiplicities = False ); # e q l i s 6 list_plot ( lis ) # l i s 30 n = 100? roots CC ComplexField(300) 1 var ( z k ) 2 nn = 200 # n n f = sum (( nn*z)^k/ factorial (k), k,0, nn) 4 eq = f ==0 5 lis = eq. roots (z, ring = ComplexField (300), multiplicities = False ) # 300 b i t 6 list_plot ( lis ) 84
91 n = 200 ze 1 z = 1 z = x + iy ze 1 z = x 2 + y 2 e 1 x 1 var ( x y ) 2 implicit_plot ( sqrt (x ^2+ y ^2)* exp (1 -x)-1, (x, -1,2), (y, -1,1), color = red ) 1 var ( z k ) 2 nn =200 3 f = sum (( nn*z)^k/ factorial (k), k,0, nn) # f 4 eq = f ==0 5 lis = eq. roots (z, ring = ComplexField (300), multiplicities = False ); 6 p1 = list_plot ( lis ) 7 var ( x y ) 8 p2 = implicit_plot ( sqrt (x ^2+ y ^2)* exp (1 -x)-1, (x, -1,2), (y, -1,1), color = red ) 9 (p1+p2 ). show () ze 1 z = 1 complex plot 40 k=1 (40z)k /k! 1 var ( k ) 2 nn =40 3 f = sum (( nn*x)^k/ factorial (k),k,0, nn) 4 complex_plot (f,( -1,2),( -1,1), plot_points =500, aspect_ratio =1) 85
92 k=1 (40z)k /k! 40 3 SageMath sagews02.sws 86
93 (expand) f f 1 f. expand () expand (f) (x + 1) 3 1 var ( x ); f = (x +1)^3 2 print f. expand () x^3 + 3*x^2 + 3*x + 1 f f (factor) 1 f. factor () factor (f) x 3 + 3x 2x 6 1 f = x^3 + 3*x^2-2*x factor (f) (x + 3)*(x^2-2) solve simplify f (simplify simplify full) f 1 f. simplify () simplify (f) 1 f. simplify_full () simplify_full (f) f = x 2 + 2x + 5 3x 1 f = x ^2 + 2* x + 5-3* x 2 simplify ( f) x^2 - x + 5 simplify simplify_full 1 sage : var ( x ); f = sin (x )^2 + cos (x )^2 87
94 41.2 x sage : f. simplify () # simplify sin ^2+ cos ^2=1 3 sin (x )^2 + cos (x )^2 # 4 sage : f. simplify_full () # 5 1 # x x var ( x ) 2 factor (x ^20-1) ( x 8 x 6 + x 4 x )( x 4 + x 3 + x 2 + x + 1 )( x 4 x 3 + x 2 x + 1 )( x ) (x + 1)(x 1) x n 1 ±1 1 var ( x ) 2 factor ( x ^105-1) ( x 48 + x 47 + x 46 x 43 x 42 2 x 41 x 40 x 39 + x 36 + x 35 + x 34 + x 33 + x 32 + x 31 x 28 x 26 x 24 x 22 x 20 + x 17 + x 16 + x 15 + x 14 + x 13 + x 12 x 9 x 8 2 x 7 x 6 x 5 + x 2 + x + 1 ) ( x 24 x 23 + x 19 x 18 + x 17 x 16 + x 14 x 13 + x 12 x 11 + x 10 x 8 + x 7 x 6 + x 5 x + 1 ) ( x 12 x 11 + x 9 x 8 + x 6 x 4 + x 3 x + 1)(x 8 x 7 + x 5 x 4 + x 3 x + 1 ) ( x 6 + x 5 + x 4 + x 3 + x 2 + x + 1 )( x 4 + x 3 + x 2 + x + 1 ) (x 2 + x + 1 )( x 1 ) ± x 2 (x + 1) 2 = 2 x (x + 1) f 1 f. partial_ fraction () 1 sage : var ( x ); f = x ^2/( x +1)^2 2 sage : f. partial_ fraction () 3-2/( x + 1) + 1/( x + 1) ^2 +1 factor 88
95 sage : var ( x ); g = -2/(x + 1) + 1/( x + 1)^ sage : g. factor () 3 x ^2/( x + 1)^ x x a 0 = x x 1 = 1/(x a 0 ) a 1 = x 1 x 2 = 1/(x 1 a 1 ) x = a x 1 x = a a x 2 1 x = a a a a 3 + a 4 + x x = [a 0 : a 1, a 2, a 3, a 4, ]. x = = = = /29 = [11; 1, 8, 1, 2] a 1 continued_fraction (a) # 2 continued_fraction_list (a, ) # bits=40 1 sage : continued_ fraction ( 345/ 29) 2 [11, 1, 8, 1, 2] 3 sage : continued_fraction ( sqrt (2)) 4 [1; 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,...] 89
96 = [1; 2, 2, 2, 2, ] continued fraction list 1 sage : a = continued_fraction_list ( sqrt (3), bits =40) #40 2 sage : a 3 [1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3] 1 sage : continued_fraction ( RealField (400)( e)) # 2 [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 3 12, 1, 1, 14, 1, 1, 16, 1, 1, 18, 1, 1, 20, 1, 1, 22, 4 1, 1, 24, 1, 1, 26, 1, 1, 28, 1, 1, 30, 1, 1, 32, 1, 5 1, 34, 1, 1, 36, 1, 1, 38, 1, 1, 40, 1, 1, 42, 1, 1, 6 44, 1, 1, 46, 1, 1, 48, 1, 1, 50, 1, 1, 52, 1, 1, 54, 7 1, 1, 56, 1, 1, 58, 1, 1, 60, 1, 1, 62, 1, 1, 64, 1, 1, 8 66, 1, 1, 68, 2] RealField(400)(e) e 41.5 Sage oo lim x a f(x) limit(...) f lim x a f(x) 1 f. limit (x = a) limit (f, x=a) 2 f. limit (x=a, dir = + ) # 3 f. limit (x=a, dir = - ) # ( e = lim ) x x x 1 sage : var ( x ) 2 sage : f = (1 + 1/x)^x 3 sage : f. limit (x=oo) 4 e # 5 sage : n(e) f.limit(x=oo) limit( f, x = oo) 41.6 Sage sum 90
97 b f(k) k=a 42 1 var ( k ) # k 2 sum (f(k),k,a,b) 1 k var ( k ); sum (k,k,1,50) 1275 sum m k = k=1 m(m + 1) 2 1 sage : var ( k m ) # k m 2 sage : ans = sum (k,k,1,m) # a n s 3 sage : print ans # a n s 4 1/2* m^2 + 1/2* m # 5 sage : factor ( ans ) # a n s 6 1/2*( m + 1)* m # k=0 1 k! = e, k=1 1 k 2 = π2 6, k=1 2 k k(k + 1) = log var ( k ) 2 print sum (1/ factorial (k),k,0, oo) 3 print sum (1/ k^2,k,1, oo) 4 print sum (2^( - k )/( k*(k+1)),k,1, oo) e 1/6*pi^2 -log(2) == Python = 1 >>> x = 3 2 >>> print x
98 42.2 solve 42 x x 3 == if while 1 >>> 2**3 == 8 2 True 3 >>> 8 > 9 4 False Sage == 1 var ( x y ) 2 x^2 + y^2 == x*y + 1 # 1 var ( x y ) # x, y ( = ) 2 f = x^2 + y^2 == x*y + 1 # f x ^2+ y ^2== x*y+1 f 1 print f # f 2 print f. rhs () # f 3 print f. lhs () # f x^2 + y^2 == x*y + 1 x*y + 1 x^2 + y^2 rhs, lhs right hand side left hand side 42.2 solve f(x) = g(x) x solve f(x) = g(x) 1 var ( x ) 2 solve (f(x )== g(x),x) # f(x)=g(x) x == 2x + 3 = 7 1 var ( x ) 2 solve (2* x +3==7, x) [x==2] x, y (solve) 1 var ( x y ) 2 solve ([ 1, 2], x,y) x + y = 6, x y = 4 92
99 42.2 solve 42 1 var ( x y ) 2 solve ([x+y==6, x-y ==4], x,y) [[x == 5, y == 1]] x x + 1 == 0 1 var ( x ); solve (x ^3+2* x +1==0) [x == -1/2*(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3)*(I*sqrt(3) + 1) - 1/3*(I*sqrt(3) - 1)/(1/18 *sqrt(59)*sqrt(3) - 1/2)^(1/3), x == -1/2*(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3)*(-I*sqrt(3) + 1) - 1/3*(-I*sqrt(3) - 1)/(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3), x == (1/18*sqrt(59) *sqrt(3) - 1/2)^(1/3) - 2/3/(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3)] 1 a = solve (x ^3+2* x +1==0, x) 2 print a [0]; print "" 3 print a [1]; print "" 4 print a [2] x == -1/2*(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3)*(I*sqrt(3) + 1) - 1/3*(I*sqrt(3) - 1)/(1/18 *sqrt(59)*sqrt(3) - 1/2)^(1/3) x == -1/2*(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3)*(-I*sqrt(3) + 1) - 1/3*(-I*sqrt(3) - 1)/(1/ 18*sqrt(59)*sqrt(3) - 1/2)^(1/3) x == (1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3) - 2/3/(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3) rhs() 1 a = solve (x ^3+2* x +1==0, x) 2 a [0]. rhs () -1/2*(1/18*sqrt(59)*sqrt(3) - 1/2)^(1/3)*(I*sqrt(3) + 1) - 1/3*(I*sqrt(3) - 1)/(1/18*sqrt(59)*sqrt(3) - 1/2) solve 1 solve (x ^5+3* x +1==0, x) [0=x^5+3x+1] 1 solve (x ^5+ x +1==0, x) [x == -1/2*(I*sqrt(3) + 1)*(1/18*sqrt(3)*sqrt(23) - 25/54)^(1/3) - 1/18*(-I*sqrt(3) + 1)/(1/18*sqrt(3)*sqrt(23) - 25/54)^(1/3) + 1/3, x == -1/2*(-I*sqrt(3) + 1)*(1/18*sqrt(3)*sqrt(23) - 25/54)^(1/3) - 1/18*(I*sqrt(3) + 1)/(1/18*sqrt(3)*sqrt(23) - 25/54)^(1/3) + 1/3, x == (1/18*sqrt(3)*sqrt(23) - 25/54)^(1/3) + 1/9/(1/18*sqrt(3)*sqrt(23) - 25/54)^(1/3) + 1/3, x == -1/2*I*sqrt(3) - 1/2, x == 1/2*I*sqrt(3) - 1/2] 1 solve ( sin (x )==1/2, x) 93
100 42.3 find root 42 [x == 1/6*pi] x = 1 6 π π 1 solve ( sin (x)* cos (x )==1/2, x) [sin(x) == 1/2/cos(x)] solve 42.3 find root find_root [a, b] 1 find_root (, a,b) find_root 1 x 2 + 2x 9 = 0 [ 5, 5] 1 sage : find_root (x ^2+2*x -9==0, -5,5) find_root (x ^2+2*x -9==0, -2,2) Traceback (click to the left of this block for traceback)... RuntimeError: f appears to have no zero on the interval f 0 find_root 1 sage : find_root ( tan (x )==8 - x ^3, -10,10) sage : find_root (x ^400, -5,5) x = 0 Newton 1 sage : limit (1/x, x=0, dir = + ) # 2 + Infinity # 3 sage : limit (1/x, x=0, dir = - ) # 4 - Infinity # 94
101 43 SAGE 1 sage : limit (1/x, x =0) 2 Infinity Infinity + lim x 0 xa (8) a assume a Restart worksheet 1 var ( a ) 2 limit (x^a, x =0) Traceback (click to the left of this block for traceback)... Is a positive, negative, or zero? #a a > 0 1 var ( a ) 2 assume (a >0) #a >0 3 limit (x^a, x =0) Traceback (click to the left of this block for traceback)... Is a an integer? # 1 var ( a ); assume (a >0) 2 limit (x^a, x=0, dir = + ) # 0 a 1 var ( a ); 2 assume (a, even ) 3 limit (x^a, x =0) 0 43 Sage f(x) 95
102 f(x) 43 SAGE 1 diff (f,x) derivative (f,x) f. derivative (x) f x 1 sage : diff ( sin (x),x) 2 cos (x) Sage f(x) f(x)dx 1 integral (f(x),x) integrate (f(x),x) 1 sage : integral ( sin (x),x) 2 -cos (x) 3 sage : integral (x ^4) 4 1/5* x^5 5 sage : integral (1/(1 - x ^3)) 6 1/3* sqrt (3)* arctan (1/3*(2* x + 1)* sqrt (3)) - 1/3* log (x - 1) 7 + 1/6* log (x^2 + x + 1) 1 sage : integral ( sin (x)/ log (x),x) 2 -( log (x)* integrate ( cos (x )/( x* log (x )^2), x) + cos (x ))/ log (x) 1 a = var ( a ) 2 integral ( cos (a*x),x) sin(a*x)/a x f f(x) b a f(x)dx 1 integral (f,x,a,b) integral (f,(x,a,b)) f. integral (x,a,b) integral integrate 1 sage : integral (x^2,x,0,2) 96
103 SAGE 2 8/ (1 x 4 ) 1/2 integral 1 0 (1 x4 ) 1/2 dx 1 var ( x ) 2 ans = integrate (1/ sqrt ((1 -x^4)),0,1) # a n s 3 print ans # a n s 4 print n( ans ) # a n s 1/4*beta(1/4, 1/2) beta β(x, y) = 1 0 t x 1 (1 t) y 1 dt Sage4* Maxima Sage integrate numerical_integral Sage f(x) b a f(x)dx 1 numerical_integral (f(x),a,b) ( ) max_points 1 sage : numerical_integral ( sin (x),0,pi) 2 ( , e - 14) sage : val = numerical_integral ( sin (x),0,pi) 2 sage : val [0]
104 SAGE numerical_integral sage : numerical_integral ( sin (1/ x),0,1) 2 ( , ) 3 sage : numerical_integral ( sin (1/ x),0,1, max_points =1000) 4 ( , e - 05) numerical_integral GNU Scientific Library(GSL) C maxima b a f(x)dx (maxima ) 1 f. nintegral (x,a,b, ) (,,, ) : 1 : 2 : 3 : 4 : 5 : 6 : 1 sage : f= sin (1/ x); f. nintegral (x,0,1) 2 ( , e -05, 8379, 1) 5 1 1/100 1 sage : f= sin (1/ x); f. nintegral (x,0,1,1/100) # 1/100 2 ( , , 567, 0)
105 44 TAYLOR 44 Taylor 44.1 Taylor f f Taylor ( Taylor ) f(x) = f(a) + f (a) 1! (x 1) + f (a) 2! (x a) f (n) (a) (x a) n + n! a = 0 Maclaurin Taylor Taylor f(a) + f (a) 1! (x 1) + f (a) 2! (x a) f (n) (a) n! (x a) n f(x) x=a x n Taylor 1 taylor (f(x),x,a,n) e x x = 0 3 Taylor 1 var ( x ) 2 taylor (e^x,x,0,3) 1/6*x^3 + 1/2*x^2 + x f(x, y) Taylor 2 f(x, y) (a, b) n Taylor 1 taylor (f(x,y),(x,a),(y,b),n) 1 var ( x y ) 2 taylor ( sin (x+y),(x,0),(y,0),4) 1 6 x3 1 2 x2 y 1 2 xy2 1 6 y3 + x + y 44.2 Taylor cos(x) Taylor x 10 1 var ( x ) # x 2 f = taylor ( cos (x),x,0,10) # f c o s (x) p1 = plot (f,(x, -9,9)) # f 4 p2 = plot ( cos (x),(x, -9,9), color = red ) # cos (x) 5 p = p1 + p2; # p 6 p. show ( ymin = -10, ymax =5) # p 99
106 Sage (1) lim h 0 (x + h) 3 x 3 h (2) lim x ( x x x! (3) lim x ) 1/x x! factorial(x) (4) 3x 37 (x + 1)(x 4) (5) 9 9x 2x 2 + 7x 4 (6) 4x 2 (x 1)(x 2) 2 (7) 8x 2 12 x(x 2 + 2x 6) 11 (8) = golden ratio (9) = pi x (10) sin(cx) c (11) x /(1 + x 2 )( x abs(x) (absolute value )) x (12) 1 a + x (13) a x (14) 1 a2 + x 2 (15) x 2 [0, 1] (16) sin(x), [0, π] (17) x cos(x) [0, π] x = 0 5 (18) x 2 e x (19) sin(x)/(1 + x 2 ) Sage answer.sage sage answer.sage 100
107 45 (print) answer.sage 1 # -*- coding : utf -8 -*- 2 print (1), 3 var ( x h ) 4 f1 = ((x+h)^3 -x ^3)/ h 5 print limit (f1,h =0) 101
108 dy dx = y x (9) y(x) = x Ce x C dy dx = y x, y(0) = 2 3 x = 0 y(0) = 1 + C = 2/3 C C = 1/3 (10) y(x) = x ex (11) (9) y = y(x) (x, y) y x (x, y) (1, y x) (slope field) m = (1 + (y x) 2 ) 1/2 V (x, y) = (m, m(y x)) 1 var ( x y ) 2 m = sqrt (1+(y-x )^2)^( -1) 3 plot_vector_field ( (m,m*(y-x)), (x, -3,3), (y, -3,3) ) (9) (0, y(0)) y = x + 1 x ( ) y = x + 1 ( ) (11)( ) 1 var ( x y ) 2 m = sqrt (1+(y-x )^2)^( -1) 3 vecf = plot_vector_field ( (m,m*(y-x)), (x, -4,4), (y, -4,4),color =" red ") 4 sol = plot (x +1 -(1/3)* e^x, (x, -4,4)) 5 asym = plot (x+1, (x, -4,4), color = black ) 6 ( vecf + sol + asym ). show ( ymin =-4, ymax =4) 102
109 46.2 Euler Euler Euler f(x, y) dy = f(x, y) (12) dx y(x 0 ) = y 0 (x 0, y 0 ) dx y(x + dx) = y(x) + f(x, y)dx (13) y x x + dx Euler y(x) x x 1 = x 0 + x y x 2 = x 1 + x y x n = x 0 + n x y y 1 = y 0 + f(x 0, y 0 ) x (14) y 2 = y 1 + f(x 1, y 1 ) x (15) y n = y n 1 + f(x n 1, y n 1 ) x (16) Euler (10) y(x) x n ((x 0, y 0 ), (x 1, y 1 ),, (x n, y n )) 1 x0, y0 = 0, 2/3 # 2 Dx= 0.5 # Delta x 3 var ( x y ) 4 f(x,y) = y-x # f(x,y) 5 SOL = [(x0,y0 )] # 6 for j in range (1,11): 103
2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa
I 2017 11 1 SageMath SageMath( Sage ) Sage Python Sage Python Sage Maxima Maxima Sage Sage Sage Linux, Mac, Windows *1 2 Sage Sage 4 1. ( sage CUI) 2. Sage ( sage.sage ) 3. Sage ( notebook() ) 4. Sage
More informationall.dvi
fortran 1996 4 18 2007 6 11 2012 11 12 1 3 1.1..................................... 3 1.2.............................. 3 2 fortran I 5 2.1 write................................ 5 2.2.................................
More informationPython Speed Learning
Python Speed Learning 1 / 76 Python 2 1 $ python 1 >>> 1 + 2 2 3 2 / 76 print : 1 print : ( ) 3 / 76 print : 1 print 1 2 print hello 3 print 1+2 4 print 7/3 5 print abs(-5*4) 4 / 76 print : 1 print 1 2
More informationPython 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 informationnum2.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 informationlistings-ext
(6) Python (2) ( ) ohsaki@kwansei.ac.jp 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1
More informationExcel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の 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 informationGraphicsWithPlotFull.nb Plot[{( 1), ( ),...}, {( ), ( ), ( )}] Plot Plot Cos x Sin x, x, 5 Π, 5 Π, AxesLabel x, y x 1 Plot AxesLabel
http://yktlab.cis.k.hosei.ac.jp/wiki/ 1(Plot) f x x x 1 1 x x ( )[( 1)_, ( )_, ( 3)_,...]=( ) Plot Plot f x, x, 5, 3 15 10 5 Plot[( ), {( ), ( ), ( )}] D g x x 3 x 3 Plot f x, g x, x, 10, 8 00 100 10 5
More information1 1 Gnuplot gnuplot Windows gnuplot gp443win32.zip gnuplot binary, contrib, demo, docs, license 5 BUGS, Chang
Gnuplot で微分積分 2011 年度前期 数学解析 I 講義資料 (2011.6.24) 矢崎成俊 ( 宮崎大学 ) 1 1 Gnuplot gnuplot http://www.gnuplot.info/ Windows gnuplot 2011 6 22 4.4.3 gp443win32.zip gnuplot binary, contrib, demo, docs, license 5
More information: 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 informationFortran90/95 [9]! (1 ) " " 5 "Hello!"! 3. (line) Fortran Fortran 1 2 * (1 ) 132 ( ) * 2 ( Fortran ) Fortran ,6 (continuation line) 1
Fortran90/95 2.1 Fortran 2-1 Hello! 1 program example2_01! end program 2! first test program ( ) 3 implicit none! 4 5 write(*,*) "Hello!"! write Hello! 6 7 stop! 8 end program example2_01 1 program 1!
More informationgnuplot.dvi
gnuplot gnuplot 1 gnuplot exit 2 10 10 2.1 2 plot x plot sin(x) plot [-20:20] sin(x) plot [-20:20][0.5:1] sin(x), x, cos(x) + - * / ** 5 ** plot 2**x y =2 x sin(x) cos(x) exp(x) e x abs(x) log(x) log10(x)
More information13 Student Software TI-Nspire CX CAS TI Web TI-Nspire CX CAS Student Software ( ) 1 Student Software 37 Student Software Nspire Nspire Nspir
13 Student Software TI-Nspire CX CAS TI Web TI-Nspire CX CAS Student Software ( ) 1 Student Software 37 Student Software 37.1 37.1 Nspire Nspire Nspire 37.1: Student Software 13 2 13 Student Software esc
More informationjoho09.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 informationx, y x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 xy (x y) (x + y) xy (x y) (x y) ( x 2 + xy + y 2) = 15 (x y)
x, y x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 1 1977 x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 xy (x y) (x + y) xy (x y) (x y) ( x 2 + xy + y 2) = 15 (x y) ( x 2 y + xy 2 x 2 2xy y 2) = 15 (x y) (x + y) (xy
More informationsin x
Mathematica 1998 7, 2001 3 Mathematica Mathematica 1 Mathematica 2 2 Mathematica 3 3 4 4 7 5 8 6 10 7 13 8 17 9 18 10 20 11 21 12 23 1 13 23 13.1............................ 24 13.2..........................
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(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1
(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1 17 Fortran Formular Tranlator Lapack Fortran FORTRAN, FORTRAN66, FORTRAN77, FORTRAN90, FORTRAN95 17.1 A Z ( ) 0 9, _, =, +, -, *,
More informationRuby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=>
Ruby Ruby 200779 ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( 2+3+4+5+6+7+8+9 ) 44 irb(main):002:0> irb irb(main):001:0> 1+2+3+4 => 10 irb(main):002:0>
More information( [1]) (1) ( ) 1: ( ) 2 2.1,,, X Y f X Y (a mapping, a map) X ( ) x Y f(x) X Y, f X Y f : X Y, X f Y f : X Y X Y f f 1 : X 1 Y 1 f 2 : X 2 Y 2 2 (X 1
2013 5 11, 2014 11 29 WWW ( ) ( ) (2014/7/6) 1 (a mapping, a map) (function) ( ) ( ) 1.1 ( ) X = {,, }, Y = {, } f( ) =, f( ) =, f( ) = f : X Y 1.1 ( ) (1) ( ) ( 1 ) (2) 1 function 1 ( [1]) (1) ( ) 1:
More information1 Mathematica 1 ê Mathematica Esc div Esc BasicInput 1.1 Ctrl + / Ctrl + / Ctrl / Mathematica N π D
1 Mathematica 1 ê 1 3 0.3333333 Mathematica 1 3 1 3 Esc div Esc BasicInput 1.1 Ctrl + / Ctrl + / Ctrl / Mathematica N π 100 N@Pi, 100D 3.141592653589793238462643383279502884197169399 3751058209749445923078164062862089986280348253
More informationuntitled
COM 6 20040920 (Mathematica-1) iijima COM 6 Mathematica (iijima@ae.keio.ac.jp) 1 COM 6 20040920 (Mathematica-1) iijima 1. Mathematica 1.1 1.2 1.3 1.4 2 COM 6 20040920 (Mathematica-1) iijima 1.1 3 COM 6
More informationtebiki00.dvi
(Linux) [ UNIX ] CMD Workshop ( ) 1 *********************************************************************** * Linux PC-UNIX UNIX * * 99% FreeBSD BSD PC-UNIX * * * ***********************************************************************
More informationi
i 3 4 4 7 5 6 3 ( ).. () 3 () (3) (4) /. 3. 4/3 7. /e 8. a > a, a = /, > a >. () a >, a =, > a > () a > b, a = b, a < b. c c n a n + b n + c n 3c n..... () /3 () + (3) / (4) /4 (5) m > n, a b >, m > n,
More information70 : 20 : A B (20 ) (30 ) 50 1
70 : 0 : A B (0 ) (30 ) 50 1 1 4 1.1................................................ 5 1. A............................................... 6 1.3 B............................................... 7 8.1 A...............................................
More information1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co
gnuplot 8 gnuplot 1 1.1 gnuplot gnuplot 2D 3D gnuplot ( ) gnuplot UNIX Windows Machintosh Excel gnuplot C 1.2 web gnuplot $ gnuplot gnuplot gnuplot> exit 1 1.3 2 gnuplot> set samples 1024 1024 gnuplot>
More informationMicrosoft Word - C.....u.K...doc
C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ
More informationWindows 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 informationOK (S) vncviewer UNIX EDS vncviewer : VNC server: eds.efc.sec.eng.shizuoka.ac.jp:51 OK 2
Mathematica I (2001 5 31, 6 7 ) UNIX EDS vncviewer Internet Exploler http://www.efc.sec.eng.shizuoka.ac.jp/admin/pubsoft/ vncviewer.exe : 1 OK (S) vncviewer UNIX EDS vncviewer : VNC server: eds.efc.sec.eng.shizuoka.ac.jp:51
More information, x R, f (x),, df dx : R R,, f : R R, f(x) ( ).,, f (a) d f dx (a), f (a) d3 f dx 3 (a),, f (n) (a) dn f dx n (a), f d f dx, f d3 f dx 3,, f (n) dn f
,,,,.,,,. R f : R R R a R, f(a + ) f(a) lim 0 (), df dx (a) f (a), f(x) x a, f (a), f(x) x a ( ). y f(a + ) y f(x) f(a+) f(a) f(a + ) f(a) f(a) x a 0 a a + x 0 a a + x y y f(x) 0 : 0, f(a+) f(a)., f(x)
More informationVer ceil floor FunctionGenerator (PTZCameraSony)
RT 2011 9 18 2009 11 15 1 2009 11 20 2009 12 4 1.2 Ver.1.0.2 ceil floor 3.2.1 4 FunctionGenerator 4.1 2009 12 7 4.2 2009 12 18 1.4 - - (PTZCameraSony) 2.2 - - 4.3 - - 2009 12 27 1.1 2011 9 18 OpenRTM-aist-1.0.0
More information10/ / /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 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20
More informationGNUPLOT 28 3 15 UNIX Microsoft-Windows GNUPLOT 4 GNUPLOT 1 GNUPLOT 2 2 3 2.1 UNIX.......................................... 3 2.2 Windows........................................ 4 2.3..................................
More informationA/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 informationI
I 6 4 10 1 1 1.1............... 1 1................ 1 1.3.................... 1.4............... 1.4.1.............. 1.4................. 1.4.3........... 3 1.4.4.. 3 1.5.......... 3 1.5.1..............
More informationI, II 1, A = A 4 : 6 = max{ A, } A A 10 10%
1 2006.4.17. A 3-312 tel: 092-726-4774, e-mail: hara@math.kyushu-u.ac.jp, http://www.math.kyushu-u.ac.jp/ hara/lectures/lectures-j.html Office hours: B A I ɛ-δ ɛ-δ 1. 2. A 1. 1. 2. 3. 4. 5. 2. ɛ-δ 1. ɛ-n
More information1990 IMO 1990/1/15 1:00-4:00 1 N N N 1, N 1 N 2, N 2 N 3 N 3 2 x x + 52 = 3 x x , A, B, C 3,, A B, C 2,,,, 7, A, B, C
0 9 (1990 1999 ) 10 (2000 ) 1900 1994 1995 1999 2 SAT ACT 1 1990 IMO 1990/1/15 1:00-4:00 1 N 1990 9 N N 1, N 1 N 2, N 2 N 3 N 3 2 x 2 + 25x + 52 = 3 x 2 + 25x + 80 3 2, 3 0 4 A, B, C 3,, A B, C 2,,,, 7,
More information18 ( ) I II III A B C(100 ) 1, 2, 3, 5 I II A B (100 ) 1, 2, 3 I II A B (80 ) 6 8 I II III A B C(80 ) 1 n (1 + x) n (1) n C 1 + n C
8 ( ) 8 5 4 I II III A B C( ),,, 5 I II A B ( ),, I II A B (8 ) 6 8 I II III A B C(8 ) n ( + x) n () n C + n C + + n C n = 7 n () 7 9 C : y = x x A(, 6) () A C () C P AP Q () () () 4 A(,, ) B(,, ) C(,,
More information1 = = = (set) (element) a A a A a A a A a A {2, 5, (0, 1)}, [ 1, 1] = {x; 1 x 1}. (proposition) A = {x; P (x)} P (x) x x a A a A Remark. (i) {2, 0, 0,
2005 4 1 1 2 2 6 3 8 4 11 5 14 6 18 7 20 8 22 9 24 10 26 11 27 http://matcmadison.edu/alehnen/weblogic/logset.htm 1 1 = = = (set) (element) a A a A a A a A a A {2, 5, (0, 1)}, [ 1, 1] = {x; 1 x 1}. (proposition)
More information08 p Boltzmann I P ( ) principle of equal probability P ( ) g ( )g ( 0 ) (4 89) (4 88) eq II 0 g ( 0 ) 0 eq Taylor eq (4 90) g P ( ) g ( ) g ( 0
08 p. 8 4 k B log g() S() k B : Boltzmann T T S k B g g heat bath, thermal reservoir... 4. I II II System I System II II I I 0 + 0 const. (4 85) g( 0 ) g ( )g ( ) g ( )g ( 0 ) (4 86) g ( )g ( 0 ) 0 (4
More informationpptx
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 informationI 2 tutimura/ I 2 p.1/??
I 2 tutimura@mist.i.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/ 2002 4 25 I 2 p.1/?? / / Makefile I 2 p.2/?? Makefile make GNU make I 2 p.3/?? Makefile L A T E X I 2 p.4/?? core (1) gcc,
More information( ) kadai4, kadai4.zip.,. 3 cos x [ π, π] Python. ( 100 ), x cos x ( ). (, ). def print cos(): print cos()
4 2010.6 1 :, HP.. HP 4 (, PGM/PPM )., python,,, 2, kadai4,.,,, ( )., ( ) N, exn.py ( 3 ex3.py ). N 3.., ( )., ( ) N, (exn.txt).. 1 ( ) kadai4, kadai4.zip.,. 3 cos x [ π, π] Python. ( 100 ), x cos x (
More information熊本県数学問題正解
00 y O x Typed by L A TEX ε ( ) (00 ) 5 4 4 ( ) http://www.ocn.ne.jp/ oboetene/plan/. ( ) (009 ) ( ).. http://www.ocn.ne.jp/ oboetene/plan/eng.html 8 i i..................................... ( )0... (
More information1. 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 informationprogrammingII2019-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名古屋工業大の数学 2000 年 ~2015 年 大学入試数学動画解説サイト
名古屋工業大の数学 年 ~5 年 大学入試数学動画解説サイト http://mathroom.jugem.jp/ 68 i 4 3 III III 3 5 3 ii 5 6 45 99 5 4 3. () r \= S n = r + r + 3r 3 + + nr n () x > f n (x) = e x + e x + 3e 3x + + ne nx f(x) = lim f n(x) lim
More informationContourPlot[{x^+y^==,(x-)^+y^==}, {x,-,}, {y,-,}, AspectRatio -> Automatic].. ContourPlot Plot AspectRatio->Automatic.. x a + y = ( ). b ContourPlot[x
3. Mathematica., : f(x) sin x Plot f(x, y) = x + y = ContourPlot f(x, y) > x 4 + (x y ) > RegionPlot (x(t), y(t)) (t sin t, cos t) ParametricPlot r = f(θ) r = sin 4θ PolarPlot.,.. x + y = (x, y). x, y.
More information数学の基礎訓練I
I 9 6 13 1 1 1.1............... 1 1................ 1 1.3.................... 1.4............... 1.4.1.............. 1.4................. 3 1.4.3........... 3 1.4.4.. 3 1.5.......... 3 1.5.1..............
More informationII Time-stamp: <05/09/30 17:14:06 waki> ii
II waki@cc.hirosaki-u.ac.jp 18 1 30 II Time-stamp: ii 1 1 1.1.................................................. 1 1.2................................................... 3 1.3..................................................
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
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 informationFor_Beginners_CAPL.indd
CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL
More information1 VisBAR edu H 2 O.....
VisBAR edu v1.03 ( ) 25 4 22 1 VisBAR edu 1 1.1....................................................... 1 1.2.................................................. 2 2 3 2.1 H 2 O.........................................
More information卒 業 研 究 報 告.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 informationt θ, τ, α, β S(, 0 P sin(θ P θ S x cos(θ SP = θ P (cos(θ, sin(θ sin(θ P t tan(θ θ 0 cos(θ tan(θ = sin(θ cos(θ ( 0t tan(θ
4 5 ( 5 3 9 4 0 5 ( 4 6 7 7 ( 0 8 3 9 ( 8 t θ, τ, α, β S(, 0 P sin(θ P θ S x cos(θ SP = θ P (cos(θ, sin(θ sin(θ P t tan(θ θ 0 cos(θ tan(θ = sin(θ cos(θ ( 0t tan(θ S θ > 0 θ < 0 ( P S(, 0 θ > 0 ( 60 θ
More informationCopyright c 2008 Zhenjiang Hu, All Right Reserved.
2008 10 27 Copyright c 2008 Zhenjiang Hu, All Right Reserved. (Bool) True False data Bool = False True Remark: not :: Bool Bool not False = True not True = False (Pattern matching) (Rewriting rules) not
More information2 A I / 58
2 A 2018.07.12 I 2 2018.07.12 1 / 58 I 2 2018.07.12 2 / 58 π-computer gnuplot 5/31 1 π-computer -X ssh π-computer gnuplot I 2 2018.07.12 3 / 58 gnuplot> gnuplot> plot sin(x) I 2 2018.07.12 4 / 58 cp -r
More informationuntitled
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 informationdi-problem.dvi
005/05/05 by. I : : : : : : : : : : : : : : : : : : : : : : : : :. II : : : : : : : : : : : : : : : : : : : : : : : : : 3 3. III : : : : : : : : : : : : : : : : : : : : : : : : 4 4. : : : : : : : : : :
More informationUNIX
2000 2 UNIX 2000 4 24 1 3 1.1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 3 1.2 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
More information2 I I / 61
2 I 2017.07.13 I 2 2017.07.13 1 / 61 I 2 2017.07.13 2 / 61 I 2 2017.07.13 3 / 61 7/13 2 7/20 I 7/27 II I 2 2017.07.13 4 / 61 π-computer gnuplot MobaXterm Wiki PC X11 DISPLAY I 2 2017.07.13 5 / 61 Mac 1.
More informationgnuplot gnuplot 1 3 y = x 3 + 3x 2 2 y = sin x sin(x) x*x*x+3*x*x
gnuplot gnuplot y = x + x y = sin x.8 sin(x) 8 7 6 x*x*x+*x*x.6.. -. -. -.6 -.8 - - - - - - - -. - -. - -.. gnuplot gnuplot> set xrange[-.:.] gnuplot> plot x**+*x** y = x x gnuolot> reset gnuplot> plot
More informationフリーセルプロの使い方
FreeCell Pro 011 2 FreeCell Pro 2002 FCPRO.HLP FreeCell Pro6.4 6.5 FreeCell Pro 1000 http://solitairelaboratory.com/fcpro.html FreeCell Pro 2009 2 3 FreeCell Pro Microsoft FC 0 Windows 3.1 FreeCell Pr
More informationIntroduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for
Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for embedded systems that use microcontrollers (MCUs)
More information211 kotaro@math.titech.ac.jp 1 R *1 n n R n *2 R n = {(x 1,..., x n ) x 1,..., x n R}. R R 2 R 3 R n R n R n D D R n *3 ) (x 1,..., x n ) f(x 1,..., x n ) f D *4 n 2 n = 1 ( ) 1 f D R n f : D R 1.1. (x,
More information29
9 .,,, 3 () C k k C k C + C + C + + C 8 + C 9 + C k C + C + C + C 3 + C 4 + C 5 + + 45 + + + 5 + + 9 + 4 + 4 + 5 4 C k k k ( + ) 4 C k k ( k) 3 n( ) n n n ( ) n ( ) n 3 ( ) 3 3 3 n 4 ( ) 4 4 4 ( ) n n
More informationy = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f() + f() + f(3) + f(4) () *4
Simpson H4 BioS. Simpson 3 3 0 x. β α (β α)3 (x α)(x β)dx = () * * x * * ɛ δ y = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f()
More information(, Goo Ishikawa, Go-o Ishikawa) ( ) 1
(, Goo Ishikawa, Go-o Ishikawa) ( ) 1 ( ) ( ) ( ) G7( ) ( ) ( ) () ( ) BD = 1 DC CE EA AF FB 0 0 BD DC CE EA AF FB =1 ( ) 2 (geometry) ( ) ( ) 3 (?) (Topology) ( ) DNA ( ) 4 ( ) ( ) 5 ( ) H. 1 : 1+ 5 2
More information2014 S hara/lectures/lectures-j.html r 1 S phone: ,
14 S1-1+13 http://www.math.kyushu-u.ac.jp/ hara/lectures/lectures-j.html r 1 S1-1+13 14.4.11. 19 phone: 9-8-4441, e-mail: hara@math.kyushu-u.ac.jp Office hours: 1 4/11 web download. I. 1. ϵ-δ 1. 3.1, 3..
More informationS I. dy fx x fx y fx + C 3 C vt dy fx 4 x, y dy yt gt + Ct + C dt v e kt xt v e kt + C k x v k + C C xt v k 3 r r + dr e kt S Sr πr dt d v } dt k e kt
S I. x yx y y, y,. F x, y, y, y,, y n http://ayapin.film.s.dendai.ac.jp/~matuda n /TeX/lecture.html PDF PS yx.................................... 3.3.................... 9.4................5..............
More informationSolutions to Quiz 1 (April 20, 2007) 1. P, Q, R (P Q) R Q (P R) P Q R (P Q) R Q (P R) X T T T T T T T T T T F T F F F T T F T F T T T T T F F F T T F
Quiz 1 Due at 10:00 a.m. on April 20, 2007 Division: ID#: Name: 1. P, Q, R (P Q) R Q (P R) P Q R (P Q) R Q (P R) X T T T T T T F T T F T T T F F T F T T T F T F T F F T T F F F T 2. 1.1 (1) (7) p.44 (1)-(4)
More informationsin cos No. sine, cosine : trigonometric function π : π = 3.4 : n = 0, ±, ±, sin + nπ = sin cos + nπ = cos : parity sin = sin : odd cos = cos : even.
08 No. : No. : No.3 : No.4 : No.5 : No.6 : No.7 : No.8 : No.9 : No.0 : No. : sin cos No. sine, cosine : trigonometric function π : π = 3.4 : n = 0, ±, ±, sin + nπ = sin cos + nπ = cos : parity sin = sin
More informationS I. dy fx x fx y fx + C 3 C dy fx 4 x, y dy v C xt y C v e kt k > xt yt gt [ v dt dt v e kt xt v e kt + C k x v + C C k xt v k 3 r r + dr e kt S dt d
S I.. http://ayapin.film.s.dendai.ac.jp/~matuda /TeX/lecture.html PDF PS.................................... 3.3.................... 9.4................5.............. 3 5. Laplace................. 5....
More information<4D F736F F D B B83578B6594BB2D834A836F815B82D082C88C60202E646F63>
電気電子数学入門 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/073471 このサンプルページの内容は, 初版 1 刷発行当時のものです. i 14 (tool) [ ] IT ( ) PC (EXCEL) HP() 1 1 4 15 3 010 9 ii 1... 1 1.1 1 1.
More information1 8, : 8.1 1, 2 z = ax + by + c ax by + z c = a b +1 x y z c = 0, (0, 0, c), n = ( a, b, 1). f = n i=1 a ii x 2 i + i<j 2a ij x i x j = ( x, A x), f =
1 8, : 8.1 1, z = ax + by + c ax by + z c = a b +1 x y z c = 0, (0, 0, c), n = ( a, b, 1). f = a ii x i + i
More information4 4 4 a b c d a b A c d A a da ad bce O E O n A n O ad bc a d n A n O 5 {a n } S n a k n a n + k S n a a n+ S n n S n n log x x {xy } x, y x + y 7 fx
4 4 5 4 I II III A B C, 5 7 I II A B,, 8, 9 I II A B O A,, Bb, b, Cc, c, c b c b b c c c OA BC P BC OP BC P AP BC n f n x xn e x! e n! n f n x f n x f n x f k x k 4 e > f n x dx k k! fx sin x cos x tan
More informationI No. sin cos sine, cosine : trigonometric function π : π =.4 : n = 0, ±, ±, sin + nπ = sin cos + nπ = cos : parity sin = sin : odd cos = cos : even.
I 0 No. : No. : No. : No.4 : No.5 : No.6 : No.7 : No.8 : No.9 : No.0 : I No. sin cos sine, cosine : trigonometric function π : π =.4 : n = 0, ±, ±, sin + nπ = sin cos + nπ = cos : parity sin = sin : odd
More informationたのしいプログラミング 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 information1. 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 informationcpall.dvi
55 7 gnuplot gnuplot Thomas Williams Colin Kelley Unix Windows MacOS gnuplot ( ) ( ) gnuplot gnuplot 7.1 gnuplot gnuplot () PC(Windows MacOS ) gnuplot http://www.gnuplot.info gnuplot 7.2 7.2.1 gnuplot
More informationB. 41 II: 2 ;; 4 B [ ] S 1 S 2 S 1 S O S 1 S P 2 3 P P : 2.13:
B. 41 II: ;; 4 B [] S 1 S S 1 S.1 O S 1 S 1.13 P 3 P 5 7 P.1:.13: 4 4.14 C d A B x l l d C B 1 l.14: AB A 1 B 0 AB 0 O OP = x P l AP BP AB AP BP 1 (.4)(.5) x l x sin = p l + x x l (.4)(.5) m d A x P O
More informationhttp://www.ns.kogakuin.ac.jp/~ft13389/lecture/physics1a2b/ pdf I 1 1 1.1 ( ) 1. 30 m µm 2. 20 cm km 3. 10 m 2 cm 2 4. 5 cm 3 km 3 5. 1 6. 1 7. 1 1.2 ( ) 1. 1 m + 10 cm 2. 1 hr + 6400 sec 3. 3.0 10 5 kg
More information2 1 Mathematica Mathematica Mathematica Mathematica Windows Mac *1 1.1 1.1 Mathematica 9-1 Expand[(x + y)^7] (x + y) 7 x y Shift *1 Mathematica 1.12
Chapter 1 Mathematica Mathematica Mathematica 1.1 Mathematica Mathematica (Wolfram Research) Windows, Mac OS X, Linux OS Mathematica 88 2012 11 9 2 Mathematica 2 1.2 Mathematica Mathematica 2 1 Mathematica
More information¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó
2 2015 4 20 1 (4/13) : ruby 2 / 49 2 ( ) : gnuplot 3 / 49 1 1 2014 6 IIJ / 4 / 49 1 ( ) / 5 / 49 ( ) 6 / 49 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 7 / 49
More informationMicrosoft Word - D JP.docx
Application Service Gateway Thunder/AX Series vthunder ライセンスキー インストール 手順 1 1.... 3 2. vthunder... 3 3. ACOS... 3 4. ID... 5 5.... 8 6.... 8 61... 8 62 GUI... 10 2 1. 概要 2. vthunder へのアクセス 方法 SSHHTTPSvThunder
More informationN88 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 informationR による統計解析入門
R May 31, 2016 R R R R Studio GUI R Console R Studio PDF URL http://ruby.kyoto-wu.ac.jp/konami/text/r R R Console Windows, Mac GUI Unix R Studio GUI R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
More information. (.8.). t + t m ü(t + t) + c u(t + t) + k u(t + t) = f(t + t) () m ü f. () c u k u t + t u Taylor t 3 u(t + t) = u(t) + t! u(t) + ( t)! = u(t) + t u(
3 8. (.8.)............................................................................................3.............................................4 Nermark β..........................................
More information( ) a, b c a 2 + b 2 = c 2. 2 1 2 2 : 2 2 = p q, p, q 2q 2 = p 2. p 2 p 2 2 2 q 2 p, q (QED)
rational number p, p, (q ) q ratio 3.14 = 3 + 1 10 + 4 100 ( ) a, b c a 2 + b 2 = c 2. 2 1 2 2 : 2 2 = p q, p, q 2q 2 = p 2. p 2 p 2 2 2 q 2 p, q (QED) ( a) ( b) a > b > 0 a < nb n A A B B A A, B B A =
More information1 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 information1
005 11 http://www.hyuki.com/girl/ http://www.hyuki.com/story/tetora.html http://www.hyuki.com/ Hiroshi Yuki c 005, All rights reserved. 1 1 3 (a + b)(a b) = a b (x + y)(x y) = x y a b x y a b x y 4 5 6
More informationContourPlot[{x^+y^==,(x-)^+y^==}, {x,-,}, {y,-,}, AspectRatio -> Automatic].5. ContourPlot Plot AspectRatio->Automatic.. x a + y = ( ). b ContourPlot[
5 3. Mathematica., : f(x) sin x Plot f(x, y) = x + y = ContourPlot f(x, y) > x 4 + (x y ) > RegionPlot (x(t), y(t)) (t sin t, cos t) ParametricPlot r = f(θ) r = sin 4θ PolarPlot.,. 5. x + y = (x, y). x,
More informationno35.dvi
p.16 1 sin x, cos x, tan x a x a, a>0, a 1 log a x a III 2 II 2 III III [3, p.36] [6] 2 [3, p.16] sin x sin x lim =1 ( ) [3, p.42] x 0 x ( ) sin x e [3, p.42] III [3, p.42] 3 3.1 5 8 *1 [5, pp.48 49] sin
More informationGNU Emacs GNU Emacs
GNU Emacs 2015 10 2 1 GNU Emacs 1 1.1....................................... 1 1.2....................................... 1 1.2.1..................................... 1 1.2.2.....................................
More information2 1 Octave Octave Window M m.m Octave Window 1.2 octave:1> a = 1 a = 1 octave:2> b = 1.23 b = octave:3> c = 3; ; % octave:4> x = pi x =
1 1 Octave GNU Octave Matlab John W. Eaton 1992 2.0.16 2.1.35 Octave Matlab gnuplot Matlab Octave MATLAB [1] Octave [1] 2.7 Octave Matlab Octave Octave 2.1.35 2.5 2.0.16 Octave 1.1 Octave octave Octave
More informationC による数値計算法入門 ( 第 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 informationML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1
2005 sumii@ecei.tohoku.ac.jp 2005 6 24 ML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1 let λ 1 let x = e1 in e2 (λx.e 2 )e 1 e 1 x e 2 λ 3 λx.(λy.e)
More information(1) (2) (3) (4) HB B ( ) (5) (6) (7) 40 (8) (9) (10)
2017 12 9 4 1 30 4 10 3 1 30 3 30 2 1 30 2 50 1 1 30 2 10 (1) (2) (3) (4) HB B ( ) (5) (6) (7) 40 (8) (9) (10) (1) i 23 c 23 0 1 2 3 4 5 6 7 8 9 a b d e f g h i (2) 23 23 (3) 23 ( 23 ) 23 x 1 x 2 23 x
More information