16년1월12일 기초수학 실습 (신성주)

2401 days 전, godseongjoo 작성

plot(Piecewise([[(0,1),x^2],[(1,2),1],[(2,3),x^2-3]]))
not True
 False False
RR(sqrt(9))
 3.00000000000000 3.00000000000000
RR(sqrt(2))
 1.41421356237310 1.41421356237310
not false
 True True
not true
 False False
True and False
 False False
True and True
 True True
False or False
 False False
(True or False) and False
 False False
True or (False and False)
 True True
1 == 1
 True True
24.prime_divisors()
 [2, 3] [2, 3]
not (True or False) == (False and True)
 True True
1 >= 1
 True True
1 + i >= 2 - i
 (I + 1) >= (-I + 2) (I + 1) >= (-I + 2)
((3/2) > 1) or (2/3 < 1)
 True True
((3/2) > 1) ^^ (2/3 < 1)
 False False
x > 1/2
 x > (1/2) x > (1/2)
s=12
 12 12
s+s
 24 24
s^s
 8916100448256 8916100448256
t=7
t+1
 8 8
a,b=1,2
c,d,e=2,3,5
a+b+c+d+e
 13 13
f = x^2 + x + 1
 x^2 + x + 1 x^2 + x + 1
x=3
f(x=3)
 13 13
[6,28,496,8128]
 [6, 28, 496, 8128] [6, 28, 496, 8128]
[1..7]
 [1, 2, 3, 4, 5, 6, 7] [1, 2, 3, 4, 5, 6, 7]
[4..9]
 [4, 5, 6, 7, 8, 9] [4, 5, 6, 7, 8, 9]
[2,4..10]
 [2, 4, 6, 8, 10] [2, 4, 6, 8, 10]
[1,4..13]
 [1, 4, 7, 10, 13] [1, 4, 7, 10, 13]
[1,11..31]
 [1, 11, 21, 31] [1, 11, 21, 31]
[1,11..35]
 [1, 11, 21, 31] [1, 11, 21, 31]
[pi,4*pi..32]
 [pi, 4*pi, 7*pi, 10*pi] [pi, 4*pi, 7*pi, 10*pi]
A = Set([2,3,3,3,2,1,8,6,3])
 {8, 1, 2, 3, 6} {8, 1, 2, 3, 6}
A.cardinality()
 5 5
8 in A
 True True
10 in A
 False False
B = Set([8,6,17,-4,20, -2 ])
 {17, 20, 6, 8, -4, -2} {17, 20, 6, 8, -4, -2}
A.union(B)
 {1, 2, 3, 6, 8, 17, 20, -4, -2} {1, 2, 3, 6, 8, 17, 20, -4, -2}
A.intersection(B)
 {8, 6} {8, 6}
A.difference(B)
 {1, 2, 3} {1, 2, 3}
B.difference(A)
 {17, 20, -4, -2} {17, 20, -4, -2}
A.symmetric_difference(B)
 {17, 2, 3, 20, 1, -4, -2} {17, 2, 3, 20, 1, -4, -2}
A = Set([1,2,3]); A
 {1, 2, 3} {1, 2, 3}
powA = A.subsets()
powA = A.subsets(); powA
 Subsets of {1, 2, 3} Subsets of {1, 2, 3}
pairsA = A.subsets(2); pairsA
 Subsets of {1, 2, 3} of size 2 Subsets of {1, 2, 3} of size 2
powA.list()
 [{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}] [{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}]
pairsA.list()
 [{1, 2}, {1, 3}, {2, 3}] [{1, 2}, {1, 3}, {2, 3}]
[-9,-7..29]
 [-9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29] [-9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29]
tan(0)
 0 0
tan(pi/4)
 1 1
tan(pi/2)
 Infinity Infinity
tan(3*pi/4)
 -1 -1
tan(pi)
 0 0
M = Set([3,6,9,12,15,18])
 {18, 3, 6, 9, 12, 15} {18, 3, 6, 9, 12, 15}
powM = M.subsets()
powM = M.subsets(); powB
 Subsets of {18, 3, 6, 9, 12, 15} Subsets of {18, 3, 6, 9, 12, 15}
powM.list()
 [{}, {18}, {3}, {6}, {9}, {12}, {15}, {18, 3}, {18, 6}, {9, 18}, {18, 12}, {18, 15}, {3, 6}, {9, 3}, {3, 12}, {3, 15}, {9, 6}, {12, 6}, {6, 15}, {9, 12}, {9, 15}, {12, 15}, {18, 3, 6}, {9, 18, 3}, {18, 3, 12}, {18, 3, 15}, {9, 18, 6}, {18, 12, 6}, {18, 6, 15}, {9, 18, 12}, {9, 18, 15}, {18, 12, 15}, {9, 3, 6}, {3, 12, 6}, {3, 6, 15}, {9, 3, 12}, {9, 3, 15}, {3, 12, 15}, {9, 12, 6}, {9, 6, 15}, {12, 6, 15}, {9, 12, 15}, {9, 18, 3, 6}, {18, 3, 12, 6}, {18, 3, 6, 15}, {9, 18, 3, 12}, {9, 18, 3, 15}, {18, 3, 12, 15}, {9, 18, 12, 6}, {9, 18, 6, 15}, {18, 12, 6, 15}, {9, 18, 12, 15}, {9, 3, 12, 6}, {9, 3, 6, 15}, {3, 12, 6, 15}, {9, 3, 12, 15}, {9, 12, 6, 15}, {9, 18, 3, 12, 6}, {9, 18, 3, 6, 15}, {18, 3, 12, 6, 15}, {9, 18, 3, 12, 15}, {9, 18, 12, 6, 15}, {9, 3, 12, 6, 15}, {18, 3, 6, 9, 12, 15}] [{}, {18}, {3}, {6}, {9}, {12}, {15}, {18, 3}, {18, 6}, {9, 18}, {18, 12}, {18, 15}, {3, 6}, {9, 3}, {3, 12}, {3, 15}, {9, 6}, {12, 6}, {6, 15}, {9, 12}, {9, 15}, {12, 15}, {18, 3, 6}, {9, 18, 3}, {18, 3, 12}, {18, 3, 15}, {9, 18, 6}, {18, 12, 6}, {18, 6, 15}, {9, 18, 12}, {9, 18, 15}, {18, 12, 15}, {9, 3, 6}, {3, 12, 6}, {3, 6, 15}, {9, 3, 12}, {9, 3, 15}, {3, 12, 15}, {9, 12, 6}, {9, 6, 15}, {12, 6, 15}, {9, 12, 15}, {9, 18, 3, 6}, {18, 3, 12, 6}, {18, 3, 6, 15}, {9, 18, 3, 12}, {9, 18, 3, 15}, {18, 3, 12, 15}, {9, 18, 12, 6}, {9, 18, 6, 15}, {18, 12, 6, 15}, {9, 18, 12, 15}, {9, 3, 12, 6}, {9, 3, 6, 15}, {3, 12, 6, 15}, {9, 3, 12, 15}, {9, 12, 6, 15}, {9, 18, 3, 12, 6}, {9, 18, 3, 6, 15}, {18, 3, 12, 6, 15}, {9, 18, 3, 12, 15}, {9, 18, 12, 6, 15}, {9, 3, 12, 6, 15}, {18, 3, 6, 9, 12, 15}]
M.cardinality
  
2^6
 64 64
[tan(x) for x in [0,pi/4..pi]]
 [0, 1, Infinity, -1, 0] [0, 1, Infinity, -1, 0]
14 // 4
 3 3
14 % 4
 2 2
divmod(14,4)
 (3, 2) (3, 2)
3.divides(15)
 True True
5.divides(17)
 False False
12.divisors()
 [1, 2, 3, 4, 6, 12] [1, 2, 3, 4, 6, 12]
101.divisors()
 [1, 101] [1, 101]
(2^19-1).is_prime()
 True True
153.is_prime()
 False False
divmod(956,98)
 (9, 74) (9, 74)
234878//3
 78292 78292
divmod(234878,3)
 (78292, 2) (78292, 2)
134.divisors(),491.divisors(),422.divisors(),1002.divisors()
 ([1, 2, 67, 134], [1, 491], [1, 2, 211, 422], [1, 2, 3, 6, 167, 334, 501, 1002]) ([1, 2, 67, 134], [1, 491], [1, 2, 211, 422], [1, 2, 3, 6, 167, 334, 501, 1002])
gcd(2,5)
 1 1
gcd(4,10)
 2 2
gcd(18,51)
 3 3
lcm(2,5)
 10 10
lcm(4,10)
 20 20
lcm(18,51)
 306 306
gcd(2,5)*lcm(2,5)
 10 10
gcd(4,10)*lcm(4,10)
 40 40
gcd(18,51)*lcm(18,51)
 918 918
max(1,5,8)
 8 8
min(1/2,1/3)
 1/3 1/3
abs(-10)
 10 10
abs(4)
 4 4